summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-10-09 10:32:43 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-11 08:11:30 +0100
commit2d6701f19057ca6bb8c42705ffc83b0318d69e90 (patch)
tree60d79cde4de6e61c863b167c3a42b50987e5d630 /bitbake/lib
parentab896df63ba058f535cb303611574f293c7c680b (diff)
downloadpoky-2d6701f19057ca6bb8c42705ffc83b0318d69e90.tar.gz
bitbake: toaster: Update JS unit tests
Update JS unit tests. - Expand the add remove layer check to make sure that the layer is actually added to the project. - Remove some unused vars - Make sure that the layers/project ids will always exist at the point of running the test. - Add the missing typeahead input fields to the dom to fix the failing typeahead test. (Bitbake rev: 46af40b95f842aa14ef7e3f0d516aef3899d5e42) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/tests/test.js32
-rw-r--r--bitbake/lib/toaster/toastergui/templates/js-unit-tests.html16
2 files changed, 28 insertions, 20 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/tests/test.js b/bitbake/lib/toaster/toastergui/static/js/tests/test.js
index f0df6e4ac1..aac0ba60a2 100644
--- a/bitbake/lib/toaster/toastergui/static/js/tests/test.js
+++ b/bitbake/lib/toaster/toastergui/static/js/tests/test.js
@@ -13,8 +13,6 @@ QUnit.test("Layer alert notification", function(assert) {
13 "name":"meta-example" 13 "name":"meta-example"
14 }; 14 };
15 15
16 var correctResponse = "You have added <strong>3</strong> layers to your project: <a id=\"layer-affected-name\" href=\"/toastergui/project/1/layer/22\">meta-example</a> and its dependencies <a href=\"/toastergui/project/1/layer/9\" data-original-title=\"\" title=\"\">meta-example-two</a>, <a href=\"/toastergui/project/1/layer/9\" data-original-title=\"\" title=\"\">meta-example-three</a>";
17
18 var layerDepsList = [ 16 var layerDepsList = [
19 { 17 {
20 "layerdetailurl":"/toastergui/project/1/layer/9", 18 "layerdetailurl":"/toastergui/project/1/layer/9",
@@ -68,9 +66,9 @@ QUnit.test("Show notification", function(assert){
68}); 66});
69 67
70var layer = { 68var layer = {
71 "id": 91, 69 "id": 1,
72 "name": "meta-crystalforest", 70 "name": "meta-testing",
73 "layerdetailurl": "/toastergui/project/4/layer/91" 71 "layerdetailurl": "/toastergui/project/1/layer/1"
74}; 72};
75 73
76QUnit.test("Add layer", function(assert){ 74QUnit.test("Add layer", function(assert){
@@ -84,11 +82,19 @@ QUnit.test("Add layer", function(assert){
84 } 82 }
85 }, 200); 83 }, 200);
86 84
87 libtoaster.addRmLayer(layer, true, function(deps){ 85 /* Compare the number of layers before and after the add in the project */
88 assert.equal(deps.length, 1); 86 libtoaster.getProjectInfo(libtoaster.ctx.projectPageUrl, function(prjInfo){
89 done(); 87 var origNumLayers = prjInfo.layers.length;
88
89 libtoaster.addRmLayer(layer, true, function(deps){
90 libtoaster.getProjectInfo(libtoaster.ctx.projectPageUrl,
91 function(prjInfo){
92 assert.ok(prjInfo.layers.length > origNumLayers,
93 "Layer not added to project");
94 done();
95 });
96 });
90 }); 97 });
91
92}); 98});
93 99
94QUnit.test("Rm layer", function(assert){ 100QUnit.test("Rm layer", function(assert){
@@ -156,7 +162,7 @@ QUnit.test("Layer btns init", function(assert){
156}); 162});
157 163
158QUnit.test("Table init", function(assert){ 164QUnit.test("Table init", function(assert){
159 assert.throws(tableInit({ url : tableUrl })); 165 assert.throws(tableInit({ url : ctx.tableUrl }));
160}); 166});
161 167
162$(document).ajaxError(function(event, jqxhr, settings, errMsg){ 168$(document).ajaxError(function(event, jqxhr, settings, errMsg){
@@ -167,9 +173,3 @@ $(document).ajaxError(function(event, jqxhr, settings, errMsg){
167 assert.notOk(jqxhr.responseText); 173 assert.notOk(jqxhr.responseText);
168 }); 174 });
169}); 175});
170
171
172
173
174
175
diff --git a/bitbake/lib/toaster/toastergui/templates/js-unit-tests.html b/bitbake/lib/toaster/toastergui/templates/js-unit-tests.html
index 5b8fd84470..8d65f33cb1 100644
--- a/bitbake/lib/toaster/toastergui/templates/js-unit-tests.html
+++ b/bitbake/lib/toaster/toastergui/templates/js-unit-tests.html
@@ -22,9 +22,11 @@
22<script src="{% static 'js/table.js' %}"></script> 22<script src="{% static 'js/table.js' %}"></script>
23 23
24<script> 24<script>
25 var tableUrl = '{% url 'projectlayers' project.pk %}'; 25 var ctx = {
26 tableUrl : '{% url 'projectlayers' project.pk %}',
27 projectId : {{project.pk}},
28 }
26</script> 29</script>
27
28<script src="{% static 'js/tests/test.js' %}"></script> 30<script src="{% static 'js/tests/test.js' %}"></script>
29 31
30<div id="qunit"></div> 32<div id="qunit"></div>
@@ -34,6 +36,12 @@
34<input type="text" id="projects" placeholder="projects"></input> 36<input type="text" id="projects" placeholder="projects"></input>
35<input type="text" id="machines" placeholder="machines"></input> 37<input type="text" id="machines" placeholder="machines"></input>
36 38
37{% endblock %} 39<!-- import layer dependency input typeahead -->
38 40<input type="text" id="layer-dependency" style="display:none"></input>
41<!-- project page input typeaheads -->
42<input type="text" id="layer-add-input" style="display:none"></input>
43<input type="text" id="machine-change-input" style="display:none"></input>
44<!-- import layer dependency input typeahead on layer details edit layer -->
45<input type="text" id="layer-dep-input" style="display:none"></input>
39 46
47{% endblock %}