From e9d397c9874fcce24b0b9975af5386ae170c59c3 Mon Sep 17 00:00:00 2001 From: Jayson Harshbarger Date: Tue, 19 Apr 2016 19:39:52 +0900 Subject: [PATCH] Fixed error message, xo, updated deps --- .gitignore | 1 + config.js | 153 ++++++++++++------- html-builder.js | 47 +++--- html.js | 77 +++++----- karma.conf.js | 22 +-- package.json | 45 ++++-- test/import-js/dom-element.js | 24 +-- test/import-js/index.html | 4 +- test/import-js/test.spec.js | 11 +- test/import-nested-elements/index.html | 5 +- test/import-nested-elements/package.json | 18 --- test/import-nested-elements/test.spec.js | 8 +- test/import-two-elements/index.html | 5 +- test/import-two-elements/main.js | 6 +- test/import-two-elements/test.spec.js | 7 +- test/import-with-dependency/dom-element.html | 4 +- test/import-with-dependency/index.html | 5 +- test/import-with-dependency/test.spec.js | 8 +- test/import/index.html | 4 +- test/import/test.spec.js | 8 +- test/index.html | 2 +- test/polymer/polymer.html | 2 +- test/tests.js | 14 +- 23 files changed, 256 insertions(+), 224 deletions(-) delete mode 100644 test/import-nested-elements/package.json diff --git a/.gitignore b/.gitignore index c055b19..519d629 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ jspm_packages node_modules +temp diff --git a/config.js b/config.js index b317114..8d1f0bf 100644 --- a/config.js +++ b/config.js @@ -1,57 +1,96 @@ -System.config({ - "baseURL": "/", - "transpiler": "traceur", - "paths": { - "*": "*.js", - "github:*": "jspm_packages/github/*.js", - "npm:*": "jspm_packages/npm/*.js" - }, - "buildCSS": false, - "defaultJSExtensions": true, - "vulvanizeHTML": { - "excludes": [ - "jspm_packages/github/Polymer/polymer@1.0.6/polymer.html" - ] - } -}); - -System.config({ - "map": { - "chai": "npm:chai@3.0.0", - "marked": "github:chjj/marked@0.3.3", - "mocha": "npm:mocha@2.2.5", - "polymer": "github:Polymer/polymer@1.0.6", - "polymerjs": "test/polymer/polymer", - "traceur": "github:jmcriffey/bower-traceur@0.0.88", - "traceur-runtime": "github:jmcriffey/bower-traceur-runtime@0.0.88", - "vulcanize": "github:Polymer/vulcanize@1.10.2", - "webcomponentsjs": "github:webcomponents/webcomponentsjs@0.7.6", - "github:jspm/nodelibs-buffer@0.1.0": { - "buffer": "npm:buffer@3.3.1" - }, - "github:jspm/nodelibs-process@0.1.1": { - "process": "npm:process@0.10.1" - }, - "npm:buffer@3.3.1": { - "base64-js": "npm:base64-js@0.0.8", - "ieee754": "npm:ieee754@1.1.6", - "is-array": "npm:is-array@1.0.1" - }, - "npm:chai@3.0.0": { - "assertion-error": "npm:assertion-error@1.0.1", - "buffer": "github:jspm/nodelibs-buffer@0.1.0", - "deep-eql": "npm:deep-eql@0.1.3", - "process": "github:jspm/nodelibs-process@0.1.1", - "systemjs-json": "github:systemjs/plugin-json@0.1.0", - "type-detect": "npm:type-detect@1.0.0" - }, - "npm:deep-eql@0.1.3": { - "buffer": "github:jspm/nodelibs-buffer@0.1.0", - "type-detect": "npm:type-detect@0.1.1" - }, - "npm:mocha@2.2.5": { - "css": "github:systemjs/plugin-css@0.1.13" - } - } -}); - +System.config({ + baseURL: "/", + defaultJSExtensions: true, + transpiler: "babel", + babelOptions: { + optional: [ + "runtime", + "optimisation.modules.system" + ] + }, + paths: { + "github:*": "jspm_packages/github/*", + "npm:*": "jspm_packages/npm/*" + }, + buildCSS: false, + vulvanizeHTML: { + excludes: [ + "jspm_packages/github/Polymer/polymer@1.4.0/polymer.html" + ] + }, + + map: { + "babel": "npm:babel-core@5.8.38", + "babel-runtime": "npm:babel-runtime@5.8.38", + "chai": "npm:chai@3.5.0", + "core-js": "npm:core-js@1.2.6", + "marked": "github:chjj/marked@0.3.5", + "mocha": "npm:mocha@2.4.5", + "polymer": "github:Polymer/polymer@1.4.0", + "polymerjs": "test/polymer/polymer", + "webcomponentsjs": "github:webcomponents/webcomponentsjs@0.7.22", + "github:jspm/nodelibs-assert@0.1.0": { + "assert": "npm:assert@1.3.0" + }, + "github:jspm/nodelibs-buffer@0.1.0": { + "buffer": "npm:buffer@3.6.0" + }, + "github:jspm/nodelibs-path@0.1.0": { + "path-browserify": "npm:path-browserify@0.0.0" + }, + "github:jspm/nodelibs-process@0.1.2": { + "process": "npm:process@0.11.2" + }, + "github:jspm/nodelibs-util@0.1.0": { + "util": "npm:util@0.10.3" + }, + "npm:assert@1.3.0": { + "util": "npm:util@0.10.3" + }, + "npm:babel-runtime@5.8.38": { + "process": "github:jspm/nodelibs-process@0.1.2" + }, + "npm:buffer@3.6.0": { + "base64-js": "npm:base64-js@0.0.8", + "child_process": "github:jspm/nodelibs-child_process@0.1.0", + "fs": "github:jspm/nodelibs-fs@0.1.2", + "ieee754": "npm:ieee754@1.1.6", + "isarray": "npm:isarray@1.0.0", + "process": "github:jspm/nodelibs-process@0.1.2" + }, + "npm:chai@3.5.0": { + "assertion-error": "npm:assertion-error@1.0.1", + "buffer": "github:jspm/nodelibs-buffer@0.1.0", + "deep-eql": "npm:deep-eql@0.1.3", + "process": "github:jspm/nodelibs-process@0.1.2", + "systemjs-json": "github:systemjs/plugin-json@0.1.0", + "type-detect": "npm:type-detect@1.0.0" + }, + "npm:core-js@1.2.6": { + "fs": "github:jspm/nodelibs-fs@0.1.2", + "path": "github:jspm/nodelibs-path@0.1.0", + "process": "github:jspm/nodelibs-process@0.1.2", + "systemjs-json": "github:systemjs/plugin-json@0.1.0" + }, + "npm:deep-eql@0.1.3": { + "buffer": "github:jspm/nodelibs-buffer@0.1.0", + "type-detect": "npm:type-detect@0.1.1" + }, + "npm:inherits@2.0.1": { + "util": "github:jspm/nodelibs-util@0.1.0" + }, + "npm:mocha@2.4.5": { + "css": "github:systemjs/plugin-css@0.1.20" + }, + "npm:path-browserify@0.0.0": { + "process": "github:jspm/nodelibs-process@0.1.2" + }, + "npm:process@0.11.2": { + "assert": "github:jspm/nodelibs-assert@0.1.0" + }, + "npm:util@0.10.3": { + "inherits": "npm:inherits@2.0.1", + "process": "github:jspm/nodelibs-process@0.1.2" + } + } +}); diff --git a/html-builder.js b/html-builder.js index 4a742cd..b3391d2 100644 --- a/html-builder.js +++ b/html-builder.js @@ -2,7 +2,6 @@ // Guy Bedford https://github.com/guybedford var Vulcan = System._nodeRequire('vulcanize'); -//var Minimize = System._nodeRequire('minimize'); var Promise = global.Promise || System._nodeRequire('es6-promise').Promise; // it's bad to do this in general, as code is now heavily environment specific @@ -13,10 +12,11 @@ var isWin = process.platform.match(/^win/); function fromFileURL(address) { address = address.replace(/^file:(\/+)?/i, ''); - if (!isWin) - address = '/' + address; - else + if (isWin) { address = address.replace(/\//g, '\\'); + } else { + address = '/' + address; + } return address; } @@ -30,9 +30,11 @@ function extend(a, b) { return a; } -function errCallback(err) { - setTimeout(function() { throw err; }); -} +/* function errCallback(err) { + setTimeout(function () { + throw err; + }); +} */ module.exports = function bundle(loads, opts) { var loader = this; @@ -62,29 +64,30 @@ module.exports = function bundle(loads, opts) { loose: false // KEEP one whitespace }); */ - var rootURL = loader.rootURL || fromFileURL(loader.baseURL); + // var rootURL = loader.rootURL || fromFileURL(loader.baseURL); var outFile = opts.outFile.replace(/\.js$/, '.html'); - var output = loads.map(function(load) { - return ''; + var output = loads.map(function (load) { + return ''; }).join('\n'); - var stubDefines =loads.map(function(load) { + var stubDefines = loads.map(function (load) { return "System\.register('" + load.name + "', [], false, function() {});"; }).join('\n'); - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { fs.writeFileSync(outFile, output); - console.log(' Vulcanizing ',outFile); - - vulcan.process(outFile, function(error, output) { - if (error) { return reject(error); } - //minimize.parse(output, function(error, output) { - //if (error) { return reject(error); } - fs.writeFileSync(outFile, output); - resolve(stubDefines); - //}); + console.log(' Vulcanizing ', outFile); + + vulcan.process(outFile, function (error, output) { + if (error) { + return reject(error); + } + // minimize.parse(output, function(error, output) { + // if (error) { return reject(error); } + fs.writeFileSync(outFile, output); + resolve(stubDefines); + // }); }); }); - }; diff --git a/html.js b/html.js index 04be3c5..f703ed2 100644 --- a/html.js +++ b/html.js @@ -4,42 +4,45 @@ https://github.com/systemjs/plugin-css */ -if (typeof window !== 'undefined') { - - exports.build = false; - - exports.fetch = function(load) { - return importHref(load); - }; - - exports.instantiate = function(load) { - return load.metadata.link.import; - }; -} else { - - exports.fetch = function(load) { +if (typeof window === 'undefined') { + exports.fetch = function (load) { load.metadata.build = true; load.metadata.format = 'defined'; return ''; }; - exports.instantiate = function() {}; - exports.bundle = function(loads, opts) { + exports.instantiate = function () {}; + exports.bundle = function (loads, opts) { var loader = this; - if (loader.buildHTML === false) { return ''; } - return loader['import']('./html-builder', { name: module.id }).then(function(builder) { + if (loader.buildHTML === false) { + return ''; + } + return loader['import']('./html-builder', {name: module.id}).then(function (builder) { return builder.call(loader, loads, opts); - }, function(err) { - throw new Error('Install Polymer/vulcanize via `jspm install npm:vulcanize` for HTML build support. Set System.buildHTML = false to skip HTML builds.'); + }, function (err) { + if (err.toString().indexOf('Cannot find module \'vulcanize\'') !== -1) { + throw new Error('Install Polymer/vulcanize via `npm install vulcanize --save-dev` for HTML build support. Set System.buildHTML = false to skip CSS builds.'); + } + throw err; }); }; +} else { + exports.build = false; + exports.fetch = function (load) { + return importHref(load); + }; + exports.instantiate = function (load) { + return load.metadata.link.import; + }; } var waitSeconds = 100; -var head = (typeof document !== 'undefined') ? document.getElementsByTagName('head')[0] : null; +var head = (typeof document === 'undefined') ? null : document.getElementsByTagName('head')[0]; function errCallback(err) { - setTimeout(function() { throw err; }); + setTimeout(function () { + throw err; + }); } // from https://github.com/ModuleLoader/es6-module-loader/issues/95#issuecomment-98705035 @@ -49,7 +52,6 @@ function processScript(script) { } function processDocument(e) { - var Q = []; // process modules in this document @@ -68,34 +70,33 @@ function processDocument(e) { } function importHref(load) { + return new Promise(function (resolve, reject) { + var link = load.metadata.link = document.createElement('link'); + link.rel = 'import'; + link.href = load.address; - return new Promise(function(resolve, reject) { - - var timeout = setTimeout(function() { + var timeout = setTimeout(function () { reject('Unable to load HTML'); }, waitSeconds * 1000); - var _callback = function(error) { + var _callback = function (error) { clearTimeout(timeout); - link.onload = link.onerror = function() {}; - setTimeout(function() { - if (error) + link.onload = link.onerror = function () {}; + setTimeout(function () { + if (error) { reject(error); - else + } else { resolve(''); + } }, 7); }; - var link = load.metadata.link = document.createElement('link'); - link.rel = 'import'; - link.href = load.address; - - link.onload = function() { - processDocument(link.import).then(function() { + link.onload = function () { + processDocument(link.import).then(function () { _callback(); }); }; - link.onerror = function(event) { + link.onerror = function (event) { _callback(event.error); }; diff --git a/karma.conf.js b/karma.conf.js index 20a6acd..f5e2cee 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,31 +1,33 @@ /* global module */ module.exports = function (config) { 'use strict'; + var configuration = { autoWatch: true, singleRun: true, - frameworks: ['jspm', 'mocha','sinon-chai'], + frameworks: ['jspm', 'mocha', 'sinon-chai'], jspm: { - packages: 'jspm_packages/', - config: 'config.js', - loadFiles: ['jspm_packages/github/webcomponents/webcomponentsjs@0.7.6/webcomponents-lite.js','test/**/test.spec.js'], - serveFiles: ['html.js','test/**/*.js','test/**/*.html','test/**/*.css'] + stripExtension: false, + loadFiles: ['jspm_packages/github/webcomponents/webcomponentsjs@0.7.22/webcomponents-lite.js', 'test/**/test.spec.js'], + serveFiles: ['./html.js', 'test/**/*.js', 'test/**/*.html', 'test/**/*.css', 'jspm_packages/**/*.js'] }, proxies: { - '/test': '/base/test' + '/html.js': '/base/html.js', + '/test': '/base/test', + '/jspm_packages': '/base/jspm_packages' }, - browsers: ['Chrome','IE','Firefox'], // web compoenents don't work in PhantomJS + browsers: ['Chrome', 'Firefox', 'Safari'], // web compoenents don't work in PhantomJS customLaunchers: { Chrome_travis_ci: { base: 'Chrome', flags: ['--no-sandbox'] } }, - reporters: ['mocha'], + reporters: ['mocha'] }; - if(process.env.TRAVIS) { - configuration.browsers = ['Firefox','Chrome_travis_ci']; + if (process.env.TRAVIS) { + configuration.browsers = ['Firefox', 'Chrome_travis_ci']; } config.set(configuration); diff --git a/package.json b/package.json index b5da3a2..4722042 100644 --- a/package.json +++ b/package.json @@ -13,17 +13,17 @@ "homepage": "https://github.com/Hypercubed/systemjs-plugin-html", "jspm": { "directories": {}, + "dependencies": { + "webcomponentsjs": "github:webcomponents/webcomponentsjs@^0.7.22" + }, "devDependencies": { + "babel": "npm:babel-core@^5.8.24", + "babel-runtime": "npm:babel-runtime@^5.8.24", "chai": "npm:chai@^3.0.0", + "core-js": "npm:core-js@^1.1.4", "marked": "github:chjj/marked@^0.3.3", "mocha": "npm:mocha@^2.2.5", - "polymer": "github:Polymer/polymer@^1.0.6", - "traceur": "github:jmcriffey/bower-traceur@0.0.88", - "traceur-runtime": "github:jmcriffey/bower-traceur-runtime@0.0.88" - }, - "buildConfig": { - "transpileES6": true, - "minify": true + "polymer": "github:Polymer/polymer@^1.0.6" } }, "description": "systemjs-plugin-html", @@ -32,28 +32,43 @@ }, "scripts": { "test": "karma start", + "test:bundle": "mkdir temp && jspm bundle test/import-two-elements/main.js temp/build.js", "postinstall": "jspm install" }, "author": "Jayson Harshbarger", "devDependencies": { "chai": "^3.0.0", - "jasmine": "^2.3.1", - "jasmine-core": "^2.3.4", - "jspm": "^0.15.7", - "karma": "^0.12.37", + "jspm": "^0.16.33", + "karma": "^0.13.22", "karma-chai": "^0.1.0", "karma-chrome-launcher": "^0.2.0", "karma-firefox-launcher": "^0.1.6", "karma-ie-launcher": "^0.2.0", - "karma-jasmine": "^0.3.6", - "karma-jspm": "^1.1.5", + "karma-jspm": "^2.1.0", "karma-mocha": "^0.2.0", - "karma-mocha-reporter": "^1.0.2", + "karma-mocha-reporter": "^2.0.1", "karma-safari-launcher": "^0.1.1", "karma-sinon-chai": "^1.0.0", - "mocha": "^2.2.5" + "lolex": "^1.4.0", + "mocha": "^2.2.5", + "sinon": "^1.17.3", + "sinon-chai": "^2.8.0", + "xo": "^0.14.0" }, "dependencies": { "vulcanize": "^1.10.2" + }, + "xo": { + "esnext": false, + "space": 2, + "envs": [ + "node", + "browser", + "mocha" + ], + "ignores": [ + "jspm_packages/**", + "config.js" + ] } } diff --git a/test/import-js/dom-element.js b/test/import-js/dom-element.js index 955165c..f4dd3a4 100644 --- a/test/import-js/dom-element.js +++ b/test/import-js/dom-element.js @@ -1,17 +1,17 @@ -import Polymer from 'polymerjs'; +import polymer from 'polymerjs'; import './dom-element.html!'; -var PolymerElement = Polymer({ - is: 'dom-element-js', - properties: { - greeting: { - type: String, - value: 'I\'m a DOM element. This is my local DOM!' - } - }, - created: function() { - this.createdRan = true; - } +var PolymerElement = polymer({ + is: 'dom-element-js', + properties: { + greeting: { + type: String, + value: 'I\'m a DOM element. This is my local DOM!' + } + }, + created: function () { + this.createdRan = true; + } }); export default PolymerElement; diff --git a/test/import-js/index.html b/test/import-js/index.html index b2ec59a..ff2ea47 100644 --- a/test/import-js/index.html +++ b/test/import-js/index.html @@ -1,8 +1,8 @@ - + diff --git a/test/import-js/test.spec.js b/test/import-js/test.spec.js index ff48d96..130b768 100644 --- a/test/import-js/test.spec.js +++ b/test/import-js/test.spec.js @@ -2,11 +2,11 @@ var chai = require('chai'); var expect = chai.expect; -describe('JS import Polymer web component', function() { +describe('JS import Polymer web component', function () { + var ctor = null; + var elm = null; - var ctor = null, elm = null; - - before(function() { + before(function () { var d = document.createElement('div'); d.style.visibility = 'hidden'; d.innerHTML = ''; @@ -14,7 +14,7 @@ describe('JS import Polymer web component', function() { elm = document.getElementById('dom-element-js-instance'); - return System.import('test/import-js/dom-element').then(function(data) { + return System.import('test/import-js/dom-element').then(function (data) { ctor = data.default; }); }); @@ -35,5 +35,4 @@ describe('JS import Polymer web component', function() { it('executes the polymer created event', function () { expect(elm.createdRan).to.equal(true); }); - }); diff --git a/test/import-nested-elements/index.html b/test/import-nested-elements/index.html index d8d1950..17d9515 100644 --- a/test/import-nested-elements/index.html +++ b/test/import-nested-elements/index.html @@ -3,17 +3,16 @@ TEST - + - diff --git a/test/import-nested-elements/package.json b/test/import-nested-elements/package.json deleted file mode 100644 index fa9df37..0000000 --- a/test/import-nested-elements/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "import-two-elements-example", - "version": "0.0.0", - "description": "", - "main": "main.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "MIT", - "jspm": { - "directories": {}, - "devDependencies": { - "traceur": "github:jmcriffey/bower-traceur@0.0.88", - "traceur-runtime": "github:jmcriffey/bower-traceur-runtime@0.0.88" - } - } -} diff --git a/test/import-nested-elements/test.spec.js b/test/import-nested-elements/test.spec.js index 8bbeb92..f5395c5 100644 --- a/test/import-nested-elements/test.spec.js +++ b/test/import-nested-elements/test.spec.js @@ -1,18 +1,17 @@ var chai = require('chai'); var expect = chai.expect; -describe('Nested HTML imports', function() { - +describe('Nested HTML imports', function () { var doc = null; - before(function() { + before(function () { var d = document.createElement('div'); d.style.visibility = 'hidden'; d.innerHTML = ''; d.innerHTML += ''; document.body.appendChild(d); - return System.import('test/import-nested-elements/dom-element.html!').then(function(m) { + return System.import('test/import-nested-elements/dom-element.html!').then(function (m) { doc = m; }); }); @@ -25,5 +24,4 @@ describe('Nested HTML imports', function() { var element = window.document.getElementById('dom-element-one2-instance'); expect(element.greeting).to.equal('I\'m a nested DOM element. This is my local DOM!'); }); - }); diff --git a/test/import-two-elements/index.html b/test/import-two-elements/index.html index f29a268..500ac69 100644 --- a/test/import-two-elements/index.html +++ b/test/import-two-elements/index.html @@ -3,17 +3,16 @@ TEST - + - diff --git a/test/import-two-elements/main.js b/test/import-two-elements/main.js index 2953335..d8be51f 100644 --- a/test/import-two-elements/main.js +++ b/test/import-two-elements/main.js @@ -3,7 +3,7 @@ window.Polymer = window.Polymer || {}; window.Polymer.dom = 'shadow'; // Add elements to be imported -import { prototype as domElementOne, document as domElementOneImport } from './dom-element-one'; -import { prototype as domElementTwo, document as domElementTwoImport } from './dom-element-two'; +import {prototype as domElementOne, document as domElementOneImport} from './dom-element-one'; +import {prototype as domElementTwo, document as domElementTwoImport} from './dom-element-two'; -export { domElementOne, domElementTwo, domElementOneImport, domElementTwoImport }; \ No newline at end of file +export {domElementOne, domElementTwo, domElementOneImport, domElementTwoImport}; diff --git a/test/import-two-elements/test.spec.js b/test/import-two-elements/test.spec.js index 4775c79..7c37b18 100644 --- a/test/import-two-elements/test.spec.js +++ b/test/import-two-elements/test.spec.js @@ -1,12 +1,11 @@ var chai = require('chai'); var expect = chai.expect; -describe('JS import with HTML import dependency', function() { - +describe('JS import with HTML import dependency', function () { var main = null; - beforeEach(function() { - return System.import('test/import-two-elements/main').then(function(m) { + beforeEach(function () { + return System.import('test/import-two-elements/main').then(function (m) { main = m; }); }); diff --git a/test/import-with-dependency/dom-element.html b/test/import-with-dependency/dom-element.html index 78bd053..91c289a 100644 --- a/test/import-with-dependency/dom-element.html +++ b/test/import-with-dependency/dom-element.html @@ -1,5 +1,5 @@ - + diff --git a/test/import-with-dependency/index.html b/test/import-with-dependency/index.html index ae17916..546f160 100644 --- a/test/import-with-dependency/index.html +++ b/test/import-with-dependency/index.html @@ -1,9 +1,8 @@ - + - diff --git a/test/import-with-dependency/test.spec.js b/test/import-with-dependency/test.spec.js index 779e1d0..ebbc182 100644 --- a/test/import-with-dependency/test.spec.js +++ b/test/import-with-dependency/test.spec.js @@ -1,17 +1,16 @@ var chai = require('chai'); var expect = chai.expect; -describe('HTML import Polymer web component with dependency', function() { - +describe('HTML import Polymer web component with dependency', function () { var doc = null; - before(function() { + before(function () { var d = document.createElement('div'); d.style.visibility = 'hidden'; d.innerHTML = ''; document.body.appendChild(d); - return System.import('test/import-with-dependency/dom-element.html!').then(function(data) { + return System.import('test/import-with-dependency/dom-element.html!').then(function (data) { doc = data; }); }); @@ -34,5 +33,4 @@ describe('HTML import Polymer web component with dependency', function() { var element = window.document.getElementById('dom-element-dep-instance'); expect(element.$.content.innerHTML).to.equal('

I\'m a DOM element. This is my local DOM!

\n'); }); - }); diff --git a/test/import/index.html b/test/import/index.html index c1b96e8..d05eeee 100644 --- a/test/import/index.html +++ b/test/import/index.html @@ -1,8 +1,8 @@ - + diff --git a/test/import/test.spec.js b/test/import/test.spec.js index 50c3c7c..1ff66ee 100644 --- a/test/import/test.spec.js +++ b/test/import/test.spec.js @@ -1,17 +1,16 @@ var chai = require('chai'); var expect = chai.expect; -describe('HTML import Polymer web component', function() { - +describe('HTML import Polymer web component', function () { var doc = null; - before(function() { + before(function () { var d = document.createElement('div'); d.style.visibility = 'hidden'; d.innerHTML = ''; document.body.appendChild(d); - return System.import('test/import/dom-element.html!').then(function(data) { + return System.import('test/import/dom-element.html!').then(function (data) { doc = data; }); }); @@ -34,5 +33,4 @@ describe('HTML import Polymer web component', function() { var element = window.document.getElementById('dom-element-instance'); expect(element.createdRan).to.equal(true); }); - }); diff --git a/test/index.html b/test/index.html index 0bcd7c4..f959ee4 100644 --- a/test/index.html +++ b/test/index.html @@ -5,7 +5,7 @@ Mocha Unit Tests - +
diff --git a/test/polymer/polymer.html b/test/polymer/polymer.html index 4d01671..da15c01 100644 --- a/test/polymer/polymer.html +++ b/test/polymer/polymer.html @@ -1,2 +1,2 @@ - + diff --git a/test/tests.js b/test/tests.js index 5d92d8d..30df0a9 100644 --- a/test/tests.js +++ b/test/tests.js @@ -1,15 +1,15 @@ var mocha = require('mocha'); mocha.setup('bdd'); -describe('HTML imports', function() { - require('./import/test.spec'); - require('./import-nested-elements/test.spec'); - require('./import-with-dependency/test.spec'); +describe('HTML imports', function () { + require('./import/test.spec'); + require('./import-nested-elements/test.spec'); + require('./import-with-dependency/test.spec'); }); -describe('JS imports', function() { - require('./import-js/test.spec'); - require('./import-two-elements/test.spec'); +describe('JS imports', function () { + require('./import-js/test.spec'); + require('./import-two-elements/test.spec'); }); mocha.run();