diff --git a/package.json b/package.json index d2e3dbe..5795475 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,11 @@ "description": "CSS plugin for StealJS", "main": "css.js", "scripts": { - "build-1": "node test/css-paths/build.js", - "build-2": "steal-tools build --config test/css-before-js/stealconfig.js --main main --baseUrl test/css-before-js/ --minify false", - "build-3": "node test/css-instantiated/build.js", - "test": "npm run eslint && npm run build-1 && npm run build-2 && npm run build-3 && npm run run-tests", + "test-builds": "node test/create-builds", + "test": "npm run eslint && npm run test-builds && npm run run-tests", "run-tests": "testee test/test.html --browsers firefox --reporter Spec", "http-server": "http-server -p 3000 --silent", - "saucelabs": "npm run build-1 && npm run build-2 && npm run build-3 && node test/saucelabs", + "saucelabs": "npm run test-builds && node test/saucelabs", "document": "bit-docs", "eslint": "eslint css.js" }, @@ -35,10 +33,10 @@ "http-server": "^0.10.0", "qunitjs": "~2.1.0", "saucelabs": "^1.4.0", - "steal": "^1.0.0", + "steal": "^1.5.1", "steal-qunit": "^1.0.0", "steal-test-helpers": "^0.2.0", - "steal-tools": "^1.0.0", + "steal-tools": "^1.3.3", "test-saucelabs": "0.0.1", "testee": "^0.5.0", "wd": "^1.2.0" diff --git a/test/create-builds.js b/test/create-builds.js new file mode 100644 index 0000000..c4925fc --- /dev/null +++ b/test/create-builds.js @@ -0,0 +1,18 @@ + +Promise.resolve() + .then(function() { + console.log("creating build for css-paths"); + return require("./css-paths/build"); + }) + .then(function() { + console.log("\ncreating build for css-before-js"); + return require("./css-before-js/build"); + }) + .then(function() { + console.log("\ncreating build for css-instantiated"); + return require("./css-instantiated/build"); + }) + .then(function() { + console.log("\ncreating build for css-local-import"); + return require("./css-local-import/build"); + }); diff --git a/test/css-before-js/build.js b/test/css-before-js/build.js new file mode 100644 index 0000000..af10775 --- /dev/null +++ b/test/css-before-js/build.js @@ -0,0 +1,9 @@ +var path = require("path"); +var stealTools = require("steal-tools"); + +module.exports = stealTools.build({ + main: "main", + config: path.join(__dirname, "stealconfig.js") +}, { + minify: false +}); diff --git a/test/css-instantiated/build.js b/test/css-instantiated/build.js index de0c4ac..642dc05 100644 --- a/test/css-instantiated/build.js +++ b/test/css-instantiated/build.js @@ -1,9 +1,9 @@ var stealTools = require("steal-tools"); -var promise = stealTools.build({ +module.exports = stealTools.build({ main: "main", config: __dirname+"/stealconfig.js" },{ minify: false, debug: true -}); \ No newline at end of file +}); diff --git a/test/css-local-import/build.js b/test/css-local-import/build.js new file mode 100644 index 0000000..aeb9e8a --- /dev/null +++ b/test/css-local-import/build.js @@ -0,0 +1,8 @@ +var path = require("path"); +var stealTools = require("steal-tools"); + +module.exports = stealTools.build({ + main: "main", + config: path.join(__dirname, "stealconfig.js") +}, { +}); diff --git a/test/css-local-import/foo.css b/test/css-local-import/foo.css new file mode 100644 index 0000000..92f08e5 --- /dev/null +++ b/test/css-local-import/foo.css @@ -0,0 +1,3 @@ +p { + font-size: 30px; +} diff --git a/test/css-local-import/main.css b/test/css-local-import/main.css new file mode 100644 index 0000000..3738ceb --- /dev/null +++ b/test/css-local-import/main.css @@ -0,0 +1,5 @@ +@import url("foo.css"); + +body { + padding-top: 50px; +} diff --git a/test/css-local-import/main.js b/test/css-local-import/main.js new file mode 100644 index 0000000..b507abd --- /dev/null +++ b/test/css-local-import/main.js @@ -0,0 +1,12 @@ +require("./main.css"); + +var p = document.getElementsByTagName("p").item(0); +var s = getComputedStyle(p); + +if (window.assert) { + assert.equal(s.fontSize, "30px", "should load the @import"); + done(); +} +else { + console.log("fontSize: ", s.fontSize); +} diff --git a/test/css-local-import/prod.html b/test/css-local-import/prod.html new file mode 100644 index 0000000..19e2436 --- /dev/null +++ b/test/css-local-import/prod.html @@ -0,0 +1,22 @@ + + +
+ ++ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. + Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at + nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec + tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget + nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, + per inceptos himenaeos. +
+ + + diff --git a/test/css-local-import/stealconfig.js b/test/css-local-import/stealconfig.js new file mode 100644 index 0000000..d56b5ec --- /dev/null +++ b/test/css-local-import/stealconfig.js @@ -0,0 +1,11 @@ +steal.config({ + ext: { + "css": "steal-css" + }, + paths: { + "steal-css": "../../css.js" + }, + cssOptions: { + timeout: '15' + } +}); diff --git a/test/css-paths/build.js b/test/css-paths/build.js index 94804f7..afe1f60 100644 --- a/test/css-paths/build.js +++ b/test/css-paths/build.js @@ -1,10 +1,10 @@ var stealTools = require("steal-tools"); -var promise = stealTools.build({ +module.exports = stealTools.build({ main: "main", config: __dirname+"/config.js" },{ minify: false, debug: true, bundleAssets: true -}); \ No newline at end of file +}); diff --git a/test/css-paths/folder/main.css b/test/css-paths/folder/main.css index 3763bec..587d995 100644 --- a/test/css-paths/folder/main.css +++ b/test/css-paths/folder/main.css @@ -6,4 +6,4 @@ } #test-relative { background-image: url("locate://bootstrap/other.png"); -} \ No newline at end of file +} diff --git a/test/test.js b/test/test.js index c0d7f47..7f1d0e9 100644 --- a/test/test.js +++ b/test/test.js @@ -32,5 +32,9 @@ QUnit.test("css files starting with attribute selectors work", function(assert) }); QUnit.test("should handle IE8/9 stylesheet limit", function(assert) { - makeIframe("ie-stylesheet-limit/dev.html", assert) + makeIframe("ie-stylesheet-limit/dev.html", assert); +}); + +QUnit.test("local @import should work in production", function(assert) { + makeIframe("css-local-import/prod.html", assert); });