diff --git a/test/.eslintrc.json b/test/.eslintrc.json
index 328c2ce3..1f335c91 100644
--- a/test/.eslintrc.json
+++ b/test/.eslintrc.json
@@ -12,6 +12,14 @@
"flush": false,
"MockInteractions": false,
"sinon": true,
- "WCT": false
+ "WCT": false,
+ "getDomType": false,
+ "setupOmnitableFixture":false
+ },
+ "rules": {
+ "no-unused-vars": [
+ "warn",
+ {"varsIgnorePattern":"omnitable"}
+ ]
}
}
diff --git a/test/basic.html b/test/basic.html
index 1af7c447..dbea4877 100644
--- a/test/basic.html
+++ b/test/basic.html
@@ -8,14 +8,13 @@
-
+
+
-
-
@@ -54,10 +53,10 @@
-
+
-
@@ -29,11 +28,9 @@
-
+
-
@@ -36,15 +35,13 @@
-
-
+
-
@@ -73,11 +72,9 @@
-
+
-
-
@@ -40,12 +38,11 @@
diff --git a/test/helpers.js b/test/helpers.js
deleted file mode 100644
index aef03d45..00000000
--- a/test/helpers.js
+++ /dev/null
@@ -1,11 +0,0 @@
-// 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;
-}
diff --git a/test/helpers/utils.js b/test/helpers/utils.js
new file mode 100644
index 00000000..bc008fb8
--- /dev/null
+++ b/test/helpers/utils.js
@@ -0,0 +1,55 @@
+(function () {
+ 'use strict';
+
+ const setupOmnitableFixture = (omnitableFixtureName, data, callback) => {
+ const omnitable = fixture(omnitableFixtureName);
+ omnitable.data = data;
+ if (omnitable.visibleColumns != null && omnitable.visibleColumns.length) {
+ callback(omnitable);
+ } else {
+ // In Polymer 1.x, the visible-columns-changed event will be fire multiple times,
+ // causing done to be called multiple times, which mocha does not allow.
+ // So using a flag to prevent multiple calls to done.
+ const onVisible = () => {
+ const columns = omnitable.visibleColumns;
+ if (Array.isArray(columns) && columns.length > 0) {
+ omnitable.removeEventListener('visible-columns-changed', onVisible);
+ Polymer.Base.async(() => callback(omnitable), 60);
+ }
+ };
+
+ omnitable.addEventListener('visible-columns-changed', onVisible);
+ }
+
+ omnitable.notifyResize();
+ return omnitable;
+ };
+
+ // Detect dom type: dom=shadow vs wc-shadydom=true
+ const getDomType = () => {
+ // 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;
+ };
+
+ const onColumnReady = (omnitable, columnIndex, done) => {
+ const checkReady = () => {
+ const {visibleColumns: visible, columns} = omnitable;
+ if (visible && visible.length > 0) {
+ omnitable.removeEventListener('visible-columns-changed', checkReady);
+ Polymer.Base.async(() => done(columns[columnIndex]), 30);
+ }
+ };
+ omnitable.addEventListener('visible-columns-changed', checkReady);
+ omnitable.notifyResize();
+ checkReady();
+ };
+
+ Object.assign(window, {setupOmnitableFixture, getDomType, onColumnReady});
+}());
+
diff --git a/test/list.html b/test/list.html
index 311ce9e8..a03c8156 100644
--- a/test/list.html
+++ b/test/list.html
@@ -8,11 +8,10 @@
-
+
-
@@ -37,11 +36,10 @@
-
+
-
@@ -36,43 +35,40 @@
-
+
-
@@ -47,43 +46,40 @@
-
+
-
@@ -50,34 +49,29 @@