|
2 | 2 |
|
3 | 3 | describe("attributes.es6", function () {
|
4 | 4 |
|
5 |
| - var basePath; |
6 |
| - |
7 |
| - before(function () { |
8 |
| - if (gpf.host() === gpf.hosts.browser) { |
9 |
| - if (config.httpPort === 0) { |
10 |
| - // published version |
11 |
| - basePath = "/gpf/test-resources/require"; |
12 |
| - } else { |
13 |
| - // local version |
14 |
| - basePath = "/test/require"; |
15 |
| - } |
16 |
| - } else { |
17 |
| - // Execution path is always the root folder of the project |
18 |
| - basePath = "test/require"; |
19 |
| - } |
20 |
| - gpf.require.configure({ |
21 |
| - base: basePath |
22 |
| - }); |
23 |
| - }); |
24 |
| - |
25 |
| - describe("Defining attributes on an ES6 class through gpf.require.define", function () { |
26 |
| - |
27 |
| - beforeEach(function () { |
28 |
| - gpf.require.configure({ |
29 |
| - clearCache: true |
30 |
| - }); |
31 |
| - }); |
32 |
| - |
33 |
| - it("loads js file defining a class with attributes", function (done) { |
34 |
| - gpf.require.define({ |
35 |
| - Test: "es6/class_with_attributes.js" |
36 |
| - }, function (require) { |
37 |
| - |
38 |
| - var Test = require.Test; |
39 |
| - |
40 |
| - }).then(undefined, done); |
41 |
| - }); |
42 |
| - |
43 |
| - }); |
| 5 | + var basePath; |
| 6 | + |
| 7 | + before(function () { |
| 8 | + if (gpf.host() === gpf.hosts.browser) { |
| 9 | + if (config.httpPort === 0) { |
| 10 | + // published version |
| 11 | + basePath = "/gpf/test-resources/require"; |
| 12 | + } else { |
| 13 | + // local version |
| 14 | + basePath = "/test/require"; |
| 15 | + } |
| 16 | + } else { |
| 17 | + // Execution path is always the root folder of the project |
| 18 | + basePath = "test/require"; |
| 19 | + } |
| 20 | + gpf.require.configure({ |
| 21 | + base: basePath |
| 22 | + }); |
| 23 | + }); |
| 24 | + |
| 25 | + describe("Defining attributes on an ES6 class through gpf.require.define", function () { |
| 26 | + |
| 27 | + beforeEach(function () { |
| 28 | + gpf.require.configure({ |
| 29 | + clearCache: true |
| 30 | + }); |
| 31 | + }); |
| 32 | + |
| 33 | + it("loads js file defining a class with attributes", function (done) { |
| 34 | + gpf.require.define({ |
| 35 | + classes: "es6/class_with_attributes.js" |
| 36 | + }, function (require) { |
| 37 | + |
| 38 | + var |
| 39 | + Attribute = require.classes.Attribute, |
| 40 | + Test = require.classes.Test; |
| 41 | + |
| 42 | + var attributes = gpf.attributes.get(Test); |
| 43 | + assert(Object.keys(attributes).length === 1); |
| 44 | + assert(attributes.id.length === 1); |
| 45 | + assert(attributes.id[0] instanceof Attribute); |
| 46 | + assert(attributes.id[0].value === 1); |
| 47 | + |
| 48 | + done(); |
| 49 | + |
| 50 | + }).then(undefined, done); |
| 51 | + }); |
| 52 | + |
| 53 | + }); |
44 | 54 |
|
45 | 55 | });
|
0 commit comments