From 1e789d5c5f958b6b82077e591722d061ebffe6d9 Mon Sep 17 00:00:00 2001 From: Daniel Ruf Date: Thu, 15 Feb 2018 00:53:02 +0100 Subject: [PATCH] tests: migrate to mocha-headless-chrome --- js/foundation.abide.js | 2 +- package.json | 8 ++++---- test/javascript/components/offcanvas.js | 2 +- test/javascript/util/box.js | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/js/foundation.abide.js b/js/foundation.abide.js index b307f29a5..52c14e3dc 100644 --- a/js/foundation.abide.js +++ b/js/foundation.abide.js @@ -229,7 +229,7 @@ class Abide extends Plugin { $el.attr('aria-describedby', errorId); } - if ($labels.filter('[for]').end().length < $labels.length) { + if ($labels.filter('[for]').length < $labels.length) { // Get the input ID or create one let elemId = $el.attr('id'); if (typeof elemId === 'undefined') { diff --git a/package.json b/package.json index 9dd311b7a..bdc14ffa0 100644 --- a/package.json +++ b/package.json @@ -11,13 +11,13 @@ "homepage": "http://foundation.zurb.com/sites", "scripts": { "start": "gulp", - "test": "npm run test:sass && npm run test:javascript:phantomjs", + "test": "npm run test:sass && npm run test:javascript:units", "test:ci": "npm run test:sass && npm run test:javascript:ci", "test:sass": "mocha test/sass/test_sass.js", "test:javascript:transpile": "gulp sass:foundation && gulp test:transpile-js", - "test:javascript:phantomjs": "npm run test:javascript:transpile && mocha-phantomjs --ignore-resource-errors test/javascript/index.html", + "test:javascript:units": "npm run test:javascript:transpile && mocha-headless-chrome -a ignore-resource-errors -f test/javascript/index.html", "test:javascript:browserstack": "npm run test:javascript:transpile && browserstack-runner", - "test:javascript:ci": "npm run test:javascript:transpile && mocha-phantomjs --ignore-resource-errors test/javascript/index.html && browserstack-runner", + "test:javascript:ci": "npm run test:javascript:transpile && mocha-headless-chrome -a ignore-resource-errors -f test/javascript/index.html && browserstack-runner", "test:visual": "gulp test", "deploy": "gulp deploy", "deploy:prep": "gulp deploy:prep", @@ -80,7 +80,7 @@ "is-empty-object": "^1.1.1", "js-yaml": "^3.8.4", "mocha": "^3.4.2", - "mocha-phantomjs": "^4.0.2", + "mocha-headless-chrome": "^1.8.2", "motion-ui": "^1.1.0", "multiline": "^1.0.2", "normalize-scss": "6.0.0", diff --git a/test/javascript/components/offcanvas.js b/test/javascript/components/offcanvas.js index a03172331..7938dbaf1 100644 --- a/test/javascript/components/offcanvas.js +++ b/test/javascript/components/offcanvas.js @@ -104,7 +104,7 @@ describe('Off Canvas', function() { plugin.$element.should.have.class('is-open'); $('body').should.have.class('is-off-canvas-open'); done(); - }, 1); + }, 30); }); plugin.open(); diff --git a/test/javascript/util/box.js b/test/javascript/util/box.js index 0f1073429..aedafed56 100644 --- a/test/javascript/util/box.js +++ b/test/javascript/util/box.js @@ -33,8 +33,8 @@ describe('Foundation box', function () { var dims = Foundation.Box.GetDimensions($("#rect-test")); - dims.width.should.equal(200); - dims.height.should.equal(100); + Math.round(dims.width).should.equal(200); // Math.round fix for IE 11 (probably because of rem) + Math.round(dims.height).should.equal(100); // Math.round fix for IE 11 (probably because of rem) }); it('parent height of element', function () { -- 2.47.2