Skip to content

Commit 324dbac

Browse files
committed
Tom kleingers
1 parent 3bea4e3 commit 324dbac

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/utils/registerCustomElement.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ export default function registerCustomElement(tag, options = {}) {
2222
typeof options.attributeChangedCallback === 'function' && options.attributeChangedCallback.call(this, name, oldValue, value);
2323
}
2424

25+
function define(tagName, CustomElement) {
26+
const existingCustomElement = customElements.get(tagName);
27+
return typeof existingCustomElement !== 'undefined' ? existingCustomElement : customElements.define(tagName, CustomElement);
28+
}
29+
2530
if (isES2015) {
2631
// ES2015 detected. We will use "class" based Custom Elements V1 specification.
2732
// If it's natively supported it will run without polyfill
@@ -45,7 +50,7 @@ export default function registerCustomElement(tag, options = {}) {
4550
CustomElement.prototype.disconnectedCallback = disconnectedCallback;
4651
CustomElement.prototype.attributeChangedCallback = attributeChangedCallback;
4752

48-
customElements.define(tag, CustomElement);
53+
define(tag, CustomElement);
4954
return CustomElement; // eslint-disable-line consistent-return
5055
} else { // eslint-disable-line no-else-return
5156
// not ES2015. We will use polyfill supported version of registering Custom Elements
@@ -73,7 +78,7 @@ export default function registerCustomElement(tag, options = {}) {
7378
CustomElement.prototype.disconnectedCallback = disconnectedCallback;
7479
CustomElement.prototype.attributeChangedCallback = attributeChangedCallback;
7580

76-
customElements.define(tag, CustomElement);
81+
define(tag, CustomElement);
7782
return CustomElement; // eslint-disable-line consistent-return
7883
}
7984
}

test/e2e/nightwatch.conf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require('babel-register')
22
var config = require('../../config')
3+
var seleniumJar = require('shelljs').find('node_modules/selenium-server/lib/runner').filter(function(file){ return file.match(/selenium-server-standalone-.*\.jar$/); });
34

45
// http://nightwatchjs.org/guide#settings-file
56
module.exports = {
@@ -8,7 +9,7 @@ module.exports = {
89

910
selenium: {
1011
start_process: true,
11-
server_path: 'node_modules/selenium-server/lib/runner/selenium-server-standalone-3.3.0.jar',
12+
server_path: seleniumJar,
1213
host: '127.0.0.1',
1314
port: 4444,
1415
cli_args: {

test/e2e/specs/basic.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// http://nightwatchjs.org/guide#usage
33

44
module.exports = {
5-
'basic': function test(browser) {
5+
basic: function test(browser) {
66
// automatically uses dev Server port from /config.index.js
77
// default: http://localhost:8080
88
// see nightwatch.conf.js
@@ -12,5 +12,5 @@ module.exports = {
1212
.url(`${devServer}/#/demos/basic`)
1313
.waitForElementVisible('demo-basic', 5000)
1414
.end();
15-
},
15+
}
1616
};

0 commit comments

Comments
 (0)