diff --git a/frontend/tests/tests/user/test_application_label.js b/frontend/tests/tests/user/test_application_label.js new file mode 100644 index 000000000..0a7248d13 --- /dev/null +++ b/frontend/tests/tests/user/test_application_label.js @@ -0,0 +1,74 @@ +var Vue = require("vuejs"); +var ApplicationListModel = require("user/ApplicationListModel"); +var ApplicationLabel = require("user/vue-components/ApplicationLabel"); +var $ = require("jquery"); +require("filters"); + +QUnit.module("user.app_label"); +QUnit.test("application name", function(assert) { + var done = assert.async(); + + var model = new ApplicationListModel(); + var appLabel = new ApplicationLabel({ + data: function() { return { model: model }; } + }).$mount(); + + model.update().done(function() { + Vue.nextTick(function() { + assert.equal( + appLabel.$el.querySelector('li > a > span').innerHTML, + model.appList[0].appData.image.ui_name + ); + + // Simulate changing currentApp + model.selectedIndex = 1; + + Vue.nextTick(function() { + assert.equal( + appLabel.$el.querySelector('li > a > span').innerHTML, + model.appList[1].appData.image.ui_name + ); + + done(); + }); + }) + }); +}); + +QUnit.test("rendering stop button", function (assert) { + var done = assert.async(); + + var model = new ApplicationListModel(); + var appLabel = new ApplicationLabel({ + data: function() { return { model: model }; } + }).$mount(); + + model.update().done(function() { + // Simulate application stopped + model.appList[0].status = 'STOPPED'; + + Vue.nextTick(function() { + assert.equal( + appLabel.$el.querySelector('li > a > span').innerHTML, + model.appList[0].appData.image.ui_name + ); + + // Test stop button disabled + assert.ok( + appLabel.$el.querySelector('#stop-button').classList.contains('disabled') + ); + + // Simulate application running + model.appList[0].status = 'RUNNING'; + + // Test stop button enabled + Vue.nextTick(function() { + assert.notOk( + appLabel.$el.querySelector('#stop-button').classList.contains('disabled') + ); + + done(); + }); + }) + }); +}); diff --git a/frontend/tests/tests/user/test_application_view.js b/frontend/tests/tests/user/test_application_view.js index c8279b76f..84e3d6fd4 100644 --- a/frontend/tests/tests/user/test_application_view.js +++ b/frontend/tests/tests/user/test_application_view.js @@ -58,7 +58,6 @@ QUnit.test("rendering iframe", function (assert) { model.selectedIndex = 1; Vue.nextTick(function() { - console.log(model.appList[1].ui_name) assert.equal( appView.$el.querySelector('.box-title').innerHTML, model.appList[1].appData.image.ui_name diff --git a/frontend/tests/testsuite.js b/frontend/tests/testsuite.js index 0a3be11b5..99a8c716b 100644 --- a/frontend/tests/testsuite.js +++ b/frontend/tests/testsuite.js @@ -2,6 +2,7 @@ require("./tests/user/test_configurables.js"); require("./tests/user/test_models.js"); require("./tests/user/test_application_list_view.js"); require("./tests/user/test_application_view.js"); +require("./tests/user/test_application_label.js"); require("./tests/vue/components/test_DataTable.js"); require("./tests/vue/components/test_ConfirmDialog.js"); require("./tests/vue/components/test_error_dialog.js"); diff --git a/frontend/user/configurables/Resolution.vue b/frontend/user/configurables/Resolution.vue index 793e9f467..9f9682fe2 100644 --- a/frontend/user/configurables/Resolution.vue +++ b/frontend/user/configurables/Resolution.vue @@ -1,7 +1,7 @@