Skip to content

Commit

Permalink
dom type in suites title
Browse files Browse the repository at this point in the history
getDomType in helpers.js
  • Loading branch information
programmer4web authored and megheaiulian committed Aug 14, 2018
1 parent 7b49a79 commit 9ebdc15
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 45 deletions.
10 changes: 6 additions & 4 deletions test/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>

<script src="./helpers.js"></script>
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../../iron-test-helpers/iron-test-helpers.html">
<link rel="import" href="helpers.html">
<link rel="import" href="../cosmoz-omnitable.html">
<link rel="import" href="../cosmoz-omnitable-columns.html">
<link rel="import" href="../demo/table-demo-behavior.html">

</head>
<body>
<test-fixture id="basic">
Expand Down Expand Up @@ -55,8 +56,9 @@
(function () {
/* global setupOmnitableFixture*/
'use strict';

suite('basic', function () {
// get dom Type from helpers.js
const domType = getDomType(); //eslint-disable-line no-undef
suite('basic' + domType, () => {
var omnitable,
data;

Expand Down Expand Up @@ -208,7 +210,7 @@
});
});

suite('it logs unnamed column', function () {
suite('it logs unnamed column' + domType, () => {
var omnitable,
data,
consoleErrorStub;
Expand Down
6 changes: 5 additions & 1 deletion test/boolean.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<script src="./helpers.js"></script>

<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../../iron-test-helpers/iron-test-helpers.html">
Expand All @@ -31,7 +32,10 @@
/* global setupOmnitableFixture*/
'use strict';

suite('basic', () => {
// get dom Type from helpers.js
const domType = getDomType(); //eslint-disable-line no-undef

suite('basic' + domType, () => {
let omnitable,
column,
data;
Expand Down
8 changes: 6 additions & 2 deletions test/fit-dropdowns.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<script src="./helpers.js"></script>

<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../../iron-test-helpers/iron-test-helpers.html">
Expand Down Expand Up @@ -39,6 +40,9 @@
<script>
(function () {
/* global setupOmnitableFixture*/
// get dom Type from helpers.js
const domType = getDomType(); //eslint-disable-line no-undef

let omnitable;
const data = [
{ id: 0, group: 'group0', name: 'Item 0' },
Expand All @@ -50,7 +54,7 @@
omnitable = setupOmnitableFixture('basic', data, () => done());
};

suite('fit-dropdowns', () => {
suite('fit-dropdowns' + domType, () => {
test('sets iron-dropdown fitInto property', done => {
instantiate(() => {
[
Expand All @@ -67,7 +71,7 @@
});
});

suite('autocomplete unit tests', () => {
suite('autocomplete unit tests' + domType, () => {
test('getComparableValue returns value converted to String', done => {
instantiate(() => {
const column = omnitable.columns[0];
Expand Down
53 changes: 28 additions & 25 deletions test/group.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<script src="./helpers.js"></script>

<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../../iron-test-helpers/iron-test-helpers.html">
Expand Down Expand Up @@ -75,7 +76,10 @@
/* global setupOmnitableFixture*/
'use strict';

suite('id', () => {
// get dom Type from helpers.js
const domType = getDomType(); //eslint-disable-line no-undef

suite('id' + domType, () => {
let omnitable,
data;

Expand Down Expand Up @@ -119,7 +123,7 @@
});
});

suite('bool', () => {
suite('bool' + domType, () => {
let omnitable,
data;

Expand Down Expand Up @@ -148,37 +152,36 @@
}, 120);
});
});
}());

suite('amount', () => {
let omnitable,
data;
suite('amount' + domType, () => {
let omnitable,
data;

setup(done => {
data = Cosmoz.TableDemoBehavior.generateTableDemoData(10, 11, 25);
omnitable = setupOmnitableFixture('amount', data, () => done());
});

test('setting groupOn property to "amount" updates property groupOnColumn', done => {
omnitable.groupOn = 'amount';

omnitable.notifyResize();
const verifyColumn = () => {
const groupOnColumn = omnitable.groupOnColumn;
if (groupOnColumn == null) {
Polymer.Base.async(verifyColumn, 50);
} else {
assert.equal(typeof groupOnColumn, 'object');
assert.equal(groupOnColumn.is, 'cosmoz-omnitable-column-amount');
assert.equal(groupOnColumn.name, 'amount', 'Expected "groupOnColumn" to be the column that matches "groupOn" value');
assert.equal(groupOnColumn, omnitable.columns[0]);
done();
}
};
Polymer.Base.async(verifyColumn, 50);
test('setting groupOn property to "amount" updates property groupOnColumn', done => {
omnitable.groupOn = 'amount';

omnitable.notifyResize();
const verifyColumn = () => {
const groupOnColumn = omnitable.groupOnColumn;
if (groupOnColumn == null) {
Polymer.Base.async(verifyColumn, 50);
} else {
assert.equal(typeof groupOnColumn, 'object');
assert.equal(groupOnColumn.is, 'cosmoz-omnitable-column-amount');
assert.equal(groupOnColumn.name, 'amount', 'Expected "groupOnColumn" to be the column that matches "groupOn" value');
assert.equal(groupOnColumn, omnitable.columns[0]);
done();
}
};
Polymer.Base.async(verifyColumn, 50);
});
});
});


}());
</script>
</body></html>
8 changes: 6 additions & 2 deletions test/hash-param.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<script src="./helpers.js"></script>

<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../../iron-test-helpers/iron-test-helpers.html">
Expand Down Expand Up @@ -40,6 +41,9 @@
<script>
(function () {
/* global setupOmnitableFixture*/
// get dom Type from helpers.js
const domType = getDomType(); //eslint-disable-line no-undef

let omnitable;
const data = [
{ id: 0, group: 'group0', name: 'Item 0' },
Expand All @@ -52,7 +56,7 @@
omnitable = setupOmnitableFixture('basic', data, () => done());
};

suite('basic-read', function () {
suite('basic-read' + domType, () => {
teardown(function (done) {
location.hash = '';
done();
Expand Down Expand Up @@ -96,7 +100,7 @@
});
});

suite('basic-write', function () {
suite('basic-write' + domType, () => {
setup(instantiate);
teardown(function (done) {
location.hash = '';
Expand Down
11 changes: 11 additions & 0 deletions test/helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Detect dom type: dom=shadow vs wc-shadydom=true
function getDomType() { //eslint-disable-line no-unused-vars
// match GET parameter named 'dom'
let param = window.location.search.match(/(\?|&)dom\=([^&]*)/), // eslint-disable-line no-useless-escape
dom;
if (Array.isArray(param) && param.length > 0) {
dom = decodeURIComponent(param[2]);
}
const domType = dom && dom === 'shadow' ? ' | Using shadow DOM' : ' | Using shady DOM';
return domType;
}
8 changes: 6 additions & 2 deletions test/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<script src="./helpers.js"></script>

<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../../iron-test-helpers/iron-test-helpers.html">
Expand Down Expand Up @@ -39,7 +40,10 @@
/* global setupOmnitableFixture*/
'use strict';

suite('basic', () => {
// get dom Type from helpers.js
const domType = getDomType(); //eslint-disable-line no-undef

suite('basic' + domType, () => {
let omnitable,
column,
data;
Expand Down Expand Up @@ -87,7 +91,7 @@
});

});
suite('horizontal', () => {
suite('horizontal' + domType, () => {
let omnitable,
column,
data;
Expand Down
11 changes: 8 additions & 3 deletions test/range-date.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<script src="./helpers.js"></script>

<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../../iron-test-helpers/iron-test-helpers.html">
Expand Down Expand Up @@ -38,6 +39,10 @@
/*global sinon chai flush setupOmnitableFixture*/
(function () {
'use strict';

// get dom Type from helpers.js
const domType = getDomType(); //eslint-disable-line no-undef

const data = [
{ age: 17,
amount: { amount: '12.4', currency: 'USD' },
Expand Down Expand Up @@ -102,7 +107,7 @@

sinon.assert.expose(chai.assert, { prefix: '' });

suite('date', function () {
suite('date' + domType, () => {
let omnitable,
column;

Expand Down Expand Up @@ -246,7 +251,7 @@
});
});

suite('datetime', function () {
suite('datetime' + domType, () => {
let omnitable,
column;

Expand Down Expand Up @@ -344,7 +349,7 @@
});
});

suite('time', function () {
suite('time' + domType, () => {
let omnitable,
column;

Expand Down
13 changes: 9 additions & 4 deletions test/range.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<script src="./helpers.js"></script>

<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../../iron-test-helpers/iron-test-helpers.html">
Expand Down Expand Up @@ -49,6 +50,10 @@
/*global sinon chai flush setupOmnitableFixture*/
(function () {
'use strict';

// get dom Type from helpers.js
const domType = getDomType(); //eslint-disable-line no-undef

const data = [
{
age: 17,
Expand Down Expand Up @@ -82,7 +87,7 @@

sinon.assert.expose(chai.assert, { prefix: '' });

suite('number', function () {
suite('number' + domType, () => {
let omnitable,
column;

Expand Down Expand Up @@ -188,7 +193,7 @@
});
});

suite('amount', function () {
suite('amount', () => {
let omnitable,
column;

Expand Down Expand Up @@ -339,7 +344,7 @@

});

suite('currency rates', function () {
suite('currency rates', () => {
let omnitable,
column;

Expand Down Expand Up @@ -448,7 +453,7 @@
});
});

suite('default currency', function () {
suite('default currency' + domType, () => {
let omnitable,
column;

Expand Down
8 changes: 6 additions & 2 deletions test/xlsx-export.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<script src="./helpers.js"></script>

<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../../iron-test-helpers/iron-test-helpers.html">
Expand Down Expand Up @@ -53,9 +54,12 @@
(function () {
'use strict';

// get dom Type from helpers.js
const domType = getDomType(); //eslint-disable-line no-undef

sinon.assert.expose(chai.assert, { prefix: '' });

suite('xlsx-export-omnitable', function () {
suite('xlsx-export-omnitable' + domType, () => {
var omnitable,
data = [
{ id: 0, 'first-name': 'Carl', amount: 12.4, date: new Date(2017, 7 - 1, 10) },
Expand Down Expand Up @@ -148,7 +152,7 @@
});
});

suite('toXlsx range tests', function () {
suite('toXlsx range tests' + domType, () => {
var omnitable,
xlsx;
const data = [
Expand Down

0 comments on commit 9ebdc15

Please sign in to comment.