]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
chore: move `core` and `util.core` tests to the `core` namespace
authorNicolas Coden <nicolas@ncoden.fr>
Mon, 26 Feb 2018 21:43:18 +0000 (22:43 +0100)
committerNicolas Coden <nicolas@ncoden.fr>
Mon, 26 Feb 2018 21:43:18 +0000 (22:43 +0100)
gulp/config.js
test/javascript/core/core.js [moved from test/javascript/util/core.js with 52% similarity]
test/javascript/core/utils.js [new file with mode: 0644]

index 1c62f416b3d7f300160bf399e8ccecb3b16cb843..57661d51c014f7e12fe1ed124190983a6967a481 100644 (file)
@@ -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'
   ]
 };
similarity index 52%
rename from test/javascript/util/core.js
rename to test/javascript/core/core.js
index cd78116a8794e690c361e33db425df77d53265c2..ad8308cd5874ab0aeaa808df30891f271f7db22d 100644 (file)
@@ -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 (file)
index 0000000..36d7e26
--- /dev/null
@@ -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;
+    });
+  });
+
+});