Skip to content

Commit b0a854d

Browse files
committed
Modify tests to prepare for delite/css
1 parent 714d8e1 commit b0a854d

40 files changed

+54
-39
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ language: node_js
22
node_js: '0.10'
33
before_script:
44
- npm install -g grunt-cli
5+
- npm install -g bower
6+
- npm install
7+
- bower install
58
script:
69
- grunt travis
710
env:

bower.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "requirejs-dplugins",
33
"version": "0.2.3",
44
"description": "AMD plugins for RequireJS",
5+
"dependencies": {
6+
"requirejs": "2.1.x"
7+
},
58
"keywords": [
69
"requirejs",
710
"amd",

tests/all.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Listing of all the plugin tests
2+
define([
3+
"./has",
4+
"./i18n"
5+
]);

tests/has.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ define([
99
setup: function () {
1010
moduleRequire = require.config({
1111
context: "module",
12-
baseUrl: "../../",
12+
baseUrl: "../../../requirejs-dplugins",
1313
config: {
1414
has: {
1515
"config-feature": true,
@@ -99,10 +99,10 @@ define([
9999
setup: function () {
100100
pluginRequire = require.config({
101101
context: "plugin",
102-
baseUrl: "../../",
102+
baseUrl: "../../../requirejs-dplugins",
103103
packages: [{
104104
name: "modules",
105-
location: "tests/testModules/"
105+
location: "tests/resources/"
106106
}],
107107
config: {
108108
has: {
@@ -116,28 +116,28 @@ define([
116116
var dfd = this.async();
117117

118118
pluginRequire([
119-
"has!config-feature?modules/module1:modules/module2",
120-
"has!config-feature2?modules/module1:modules/module2"
121-
], dfd.callback(function (module1, module2) {
122-
assert.strictEqual(module1.msg, "module 1",
123-
"config-feature is true so has should resolve to module1");
124-
assert.strictEqual(module2.msg, "module 2",
125-
"config-feature2 is false so has should resolve to module2");
119+
"has!config-feature?modules/has1:modules/has2",
120+
"has!config-feature2?modules/has1:modules/has2"
121+
], dfd.callback(function (has1, has2) {
122+
assert.strictEqual(has1.msg, "module 1",
123+
"config-feature is true so has should resolve to has1");
124+
assert.strictEqual(has2.msg, "module 2",
125+
"config-feature2 is false so has should resolve to has2");
126126
}));
127127
},
128128
"ternary variation": function () {
129129
var dfd = this.async();
130130

131131
pluginRequire([
132-
"has!config-feature?modules/module1",
133-
"has!config-feature?:modules/module2",
134-
"has!config-feature2?modules/module1",
135-
"has!config-feature2?:modules/module2"
136-
], dfd.callback(function (module1, undefined2, undefined1, module2) {
137-
assert.strictEqual(module1.msg, "module 1",
138-
"config-feature is true so has should resolve to module1");
139-
assert.strictEqual(module2.msg, "module 2",
140-
"config-feature2 is false so has should resolve to module2");
132+
"has!config-feature?modules/has1",
133+
"has!config-feature?:modules/has2",
134+
"has!config-feature2?modules/has1",
135+
"has!config-feature2?:modules/has2"
136+
], dfd.callback(function (has1, undefined2, undefined1, has2) {
137+
assert.strictEqual(has1.msg, "module 1",
138+
"config-feature is true so has should resolve to has1");
139+
assert.strictEqual(has2.msg, "module 2",
140+
"config-feature2 is false so has should resolve to has2");
141141
assert.isUndefined(undefined2);
142142
assert.isUndefined(undefined1);
143143
}));
@@ -146,33 +146,33 @@ define([
146146
var dfd = this.async();
147147

148148
pluginRequire([
149-
"has!config-feature?modules/module1:config-feature2?modules/module2:modules/module3",
150-
"has!config-feature2?modules/module1:config-feature?modules/module2:modules/module3",
151-
"has!config-feature2?modules/module1:config-feature2?modules/module2:modules/module3"
152-
], dfd.callback(function (module1, module2, module3) {
153-
assert.strictEqual(module1.msg, "module 1");
154-
assert.strictEqual(module2.msg, "module 2");
155-
assert.strictEqual(module3.msg, "module 3");
149+
"has!config-feature?modules/has1:config-feature2?modules/has2:modules/has3",
150+
"has!config-feature2?modules/has1:config-feature?modules/has2:modules/has3",
151+
"has!config-feature2?modules/has1:config-feature2?modules/has2:modules/has3"
152+
], dfd.callback(function (has1, has2, has3) {
153+
assert.strictEqual(has1.msg, "module 1");
154+
assert.strictEqual(has2.msg, "module 2");
155+
assert.strictEqual(has3.msg, "module 3");
156156
}));
157157
},
158158
"undefined feature": function () {
159159
var dfd = this.async();
160160

161161
pluginRequire([
162-
"has!undef-feature?modules/module1:modules/module2"
163-
], dfd.callback(function (module2) {
164-
assert.strictEqual(module2.msg, "module 2");
162+
"has!undef-feature?modules/has1:modules/has2"
163+
], dfd.callback(function (has2) {
164+
assert.strictEqual(has2.msg, "module 2");
165165
}));
166166
},
167167
"normalization": function () {
168168
var dfd = this.async();
169169

170170
pluginRequire([
171-
"has!config-feature?./tests/testModules/module1",
172-
"has!config-feature?./tests/testModules/plugin!./resources!test"
173-
], dfd.callback(function (module1, plugin) {
174-
assert.strictEqual(module1.msg, "module 1");
175-
assert.strictEqual(plugin.res, "./resources!test");
171+
"has!config-feature?./tests/resources/has1",
172+
"has!config-feature?./tests/resources/hasplugin!./resources!test"
173+
], dfd.callback(function (has1, hasplugin) {
174+
assert.strictEqual(has1.msg, "module 1");
175+
assert.strictEqual(hasplugin.res, "./resources!test");
176176
}));
177177
}
178178

tests/i18n.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ define([
1414
context = getNewContext();
1515
require.config({
1616
context: context,
17-
baseUrl: "../../",
17+
baseUrl: "../../../requirejs-dplugins",
1818
packages: [{
1919
name: "myapp",
20-
location: "tests/testApp/dist/myapp"
20+
location: "tests/resources/app/dist/myapp"
2121
}],
2222
config: {
2323
i18n: {

tests/intern.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,17 @@ define({
8484
port: 4444
8585
},
8686

87+
loader: {
88+
baseUrl: typeof window !== "undefined" ? "../../.." : ".."
89+
},
8790
useLoader: {
88-
"host-browser": "../../node_modules/requirejs/require.js"
91+
"host-node": "requirejs",
92+
"host-browser": "../../../requirejs/require.js"
8993
},
9094

9195
// Non-functional test suite(s) to run in each browser
92-
suites: ["tests/has", "tests/i18n"],
96+
suites: ["requirejs-dplugins/tests/all"],
9397

9498
// A regular expression matching URLs to files that should not be included in code coverage analysis
95-
excludeInstrumentation: /^(?:tests|node_modules)/
99+
excludeInstrumentation: /(?:requirejs(\/|\\)|tests|node_modules)/
96100
});

0 commit comments

Comments
 (0)