From d5464859438ee8b35a89a2aca10e92108a78545d Mon Sep 17 00:00:00 2001 From: Nicolas Coden Date: Mon, 26 Feb 2018 22:43:18 +0100 Subject: [PATCH] chore: move `core` and `util.core` tests to the `core` namespace --- gulp/config.js | 5 ++-- test/javascript/{util => core}/core.js | 41 +------------------------- test/javascript/core/utils.js | 41 ++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 42 deletions(-) rename test/javascript/{util => core}/core.js (52%) create mode 100644 test/javascript/core/utils.js diff --git a/gulp/config.js b/gulp/config.js index 1c62f416b..57661d51c 100644 --- a/gulp/config.js +++ b/gulp/config.js @@ -82,7 +82,8 @@ module.exports = { // Tests TEST_JS_FILES: [ - 'test/javascript/components/**/*.js', - 'test/javascript/util/**/*.js' + 'test/javascript/core/**/*.js', + 'test/javascript/util/**/*.js', + 'test/javascript/components/**/*.js' ] }; diff --git a/test/javascript/util/core.js b/test/javascript/core/core.js similarity index 52% rename from test/javascript/util/core.js rename to test/javascript/core/core.js index cd78116a8..ad8308cd5 100644 --- a/test/javascript/util/core.js +++ b/test/javascript/core/core.js @@ -7,16 +7,6 @@ describe('Foundation core', function() { ($.fn.foundation).should.to.be.a('function'); }); - describe('rtl()', function() { - it('detects the text direction on the document', function() { - (Foundation.rtl()).should.be.false; - $('html').attr('dir', 'rtl'); - - (Foundation.rtl()).should.be.true; - $('html').attr('dir', 'ltr'); - }); - }); - describe('plugin()', function() { afterEach(function() { delete Foundation._plugins['plugin']; @@ -48,36 +38,7 @@ describe('Foundation core', function() { it('un-registers a plugin being destroyed'); }); - xdescribe('reInit()', function() { - - }); - - describe('GetYoDigits()', function() { - it('generates a random ID matching a given length', function() { - var id = Foundation.GetYoDigits(6); - - id.should.be.a('string'); - id.should.have.lengthOf(6); - }); - - it('can append a namespace to the number', function() { - var id = Foundation.GetYoDigits(6, 'plugin'); - - id.should.be.a('string'); - id.should.have.lengthOf(6 + '-plugin'.length); - id.should.contain('-plugin'); - }); - }); - - describe('RegExpEscape()', function() { - it('escape all special characters in a string for RegExp', function () { - const str = 'abc012-[]{}()*+?.,\\^$|#\s\t\r\n'; - const notstr = 'abc012-[]{}not-the-escaped-string'; - const reg = new RegExp(Foundation.RegExpEscape(str), 'g'); - - reg.test(str).should.be.true; - reg.test(notstr).should.be.false; - }); + describe('reInit()', function() { }); describe('reflow()', function() { diff --git a/test/javascript/core/utils.js b/test/javascript/core/utils.js new file mode 100644 index 000000000..36d7e2679 --- /dev/null +++ b/test/javascript/core/utils.js @@ -0,0 +1,41 @@ +describe('Foundation core utils', function() { + + describe('rtl()', function() { + it('detects the text direction on the document', function() { + (Foundation.rtl()).should.be.false; + $('html').attr('dir', 'rtl'); + + (Foundation.rtl()).should.be.true; + $('html').attr('dir', 'ltr'); + }); + }); + + describe('GetYoDigits()', function() { + it('generates a random ID matching a given length', function() { + var id = Foundation.GetYoDigits(6); + + id.should.be.a('string'); + id.should.have.lengthOf(6); + }); + + it('can append a namespace to the number', function() { + var id = Foundation.GetYoDigits(6, 'plugin'); + + id.should.be.a('string'); + id.should.have.lengthOf(6 + '-plugin'.length); + id.should.contain('-plugin'); + }); + }); + + describe('RegExpEscape()', function() { + it('escape all special characters in a string for RegExp', function () { + const str = 'abc012-[]{}()*+?.,\\^$|#\s\t\r\n'; + const notstr = 'abc012-[]{}not-the-escaped-string'; + const reg = new RegExp(Foundation.RegExpEscape(str), 'g'); + + reg.test(str).should.be.true; + reg.test(notstr).should.be.false; + }); + }); + +}); -- 2.47.2