diff options
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/tests/test.js | 32 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/js-unit-tests.html | 16 |
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 | ||
70 | var layer = { | 68 | var 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 | ||
76 | QUnit.test("Add layer", function(assert){ | 74 | QUnit.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 | ||
94 | QUnit.test("Rm layer", function(assert){ | 100 | QUnit.test("Rm layer", function(assert){ |
@@ -156,7 +162,7 @@ QUnit.test("Layer btns init", function(assert){ | |||
156 | }); | 162 | }); |
157 | 163 | ||
158 | QUnit.test("Table init", function(assert){ | 164 | QUnit.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 %} | ||