]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Fixed argument passing for Foundation spies and added some basic Interchange tests... 4228/head
authorSean Timm <sean@seantimm.com>
Sat, 1 Feb 2014 00:09:48 +0000 (17:09 -0700)
committerSean Timm <sean@seantimm.com>
Sat, 1 Feb 2014 00:09:48 +0000 (17:09 -0700)
16 files changed:
spec/abide/abide.js
spec/accordion/accordion.js
spec/alert/alert.js
spec/clearing/clearing.js
spec/dropdown/dropdown.js
spec/framework/framework.js
spec/interchange/basic.html [new file with mode: 0644]
spec/interchange/interchange.js
spec/joyride/joyride.js
spec/magellan/magellan.js
spec/offcanvas/offcanvas.js
spec/orbit/orbit.js
spec/reveal/reveal.js
spec/tab/tab.js
spec/tooltip/tooltip.js
spec/topbar/topbar.js

index 584b67edc03bbef98b35a3e91ebeed659dc39fa1..23a219e39f61daeb37c0777435162582f1be0baf 100644 (file)
@@ -6,7 +6,7 @@ describe('abide:', function() {
 
     var origFunc = $.fn.foundation;
     spyOn($.fn, 'foundation').andCallFake(function() {
-      var result = origFunc.apply(this);
+      var result = origFunc.apply(this, arguments);
       jasmine.Clock.tick(1000); // Let things settle...
       return result;
     });
index 6ff01ccbdb9f48b77f70d5be1b0fcf1932059d60..5f85b50bfdadfea36bda4fa3f05e9dce7e46323f 100644 (file)
@@ -6,7 +6,7 @@ describe('accordion:', function() {
 
     var origFunc = $.fn.foundation;
     spyOn($.fn, 'foundation').andCallFake(function() {
-      var result = origFunc.apply(this);
+      var result = origFunc.apply(this, arguments);
       jasmine.Clock.tick(1000); // Let things settle...
       return result;
     });
index 990597b5dd4d156f71fbefd78cb6d07e7e6d6e57..d82d9fa278692fc5de3bcd269b51ed645e5a99a7 100644 (file)
@@ -6,7 +6,7 @@ describe('alert:', function() {
 
     var origFunc = $.fn.foundation;
     spyOn($.fn, 'foundation').andCallFake(function() {
-      var result = origFunc.apply(this);
+      var result = origFunc.apply(this, arguments);
       jasmine.Clock.tick(1000); // Let things settle...
       return result;
     });
index 4aeaa97de23395ccb8707748b2b6da720ecc0f60..758973ce53b22bd14a178cd6f2304460ef440a78 100644 (file)
@@ -6,7 +6,7 @@ describe('clearing:', function() {
 
     var origFunc = $.fn.foundation;
     spyOn($.fn, 'foundation').andCallFake(function() {
-      var result = origFunc.apply(this);
+      var result = origFunc.apply(this, arguments);
       jasmine.Clock.tick(1000); // Let things settle...
       return result;
     });
index 0d285d39eec5ef33f35198b744795f3e50cbc628..1952ae6ce165ccc021101905cc08bf8ff555a6e7 100644 (file)
@@ -6,7 +6,7 @@ describe('dropdown:', function() {
 
     var origFunc = $.fn.foundation;
     spyOn($.fn, 'foundation').andCallFake(function() {
-      var result = origFunc.apply(this);
+      var result = origFunc.apply(this, arguments);
       jasmine.Clock.tick(1000); // Let things settle...
       return result;
     });
index 404039810fa10b3782117780fd3c9398e6897531..68d4ccd4054c9069af9b38959a0b72b2a65c0a30 100644 (file)
@@ -6,7 +6,7 @@ describe('Foundation Framework:', function() {
 
     var origFunc = $.fn.foundation;
     spyOn($.fn, 'foundation').andCallFake(function() {
-      var result = origFunc.apply(this);
+      var result = origFunc.apply(this, arguments);
       jasmine.Clock.tick(1000); // Let things settle...
       return result;
     });
diff --git a/spec/interchange/basic.html b/spec/interchange/basic.html
new file mode 100644 (file)
index 0000000..acea6c6
--- /dev/null
@@ -0,0 +1,3 @@
+<div data-interchange="[default.html, (default)], [medium.html, (medium)], [large.html, (large)]">
+  <h1 id="default">DEFAULT</h1>
+</div>
index 92a54eba18f5c35cfc25d3426b6b22f4e27899f2..97bca03bd63c332ab38513ee19f5c706c2426c8a 100644 (file)
@@ -6,9 +6,55 @@ describe('interchange:', function() {
 
     var origFunc = $.fn.foundation;
     spyOn($.fn, 'foundation').andCallFake(function() {
-      var result = origFunc.apply(this);
+      var result = origFunc.apply(this, arguments);
       jasmine.Clock.tick(1000); // Let things settle...
       return result;
     });
+
+    spyOn($, 'get').andCallFake(function(path, callback) {
+      switch(path) {
+        case 'default.html':
+          callback('<h1 id="default">DEFAULT</h1>');
+        case 'medium.html':
+          callback('<h1 id="medium">MEDIUM</h1>');
+        case 'large.html':
+          callback('<h1 id="large">LARGE</h1>');
+      }
+    });
   });
+
+  describe('when below the large breakpoint', when_not('large', function() {
+    describe('when below the medium breakpoint', when_not('medium', function() {
+      describe('with html content interchange', function() {
+        beforeEach(function() {
+          document.body.innerHTML = __html__['spec/interchange/basic.html'];
+        });
+
+        it('shows the default html content', function() {
+          $(document).foundation();
+
+          expect($('[data-interchange]').length).toBe(1);
+          expect($('#medium').length).toBe(0);
+          expect($('#large').length).toBe(0);
+        });
+      });
+    }));
+  }));
+
+  describe('when above the large breakpoint', when('large', function() {
+      describe('with html content interchange', function() {
+        beforeEach(function() {
+          document.body.innerHTML = __html__['spec/interchange/basic.html'];
+        });
+
+        // Disabling for now... HTML partials may be misbehaving.
+        xit('shows the large html content', function() {
+          $(document).foundation();
+
+          expect($('#default').length).toBe(0);
+          expect($('#medium').length).toBe(0);
+          expect($('#large').length).toBe(1);
+        });
+      });
+  }));
 });
index 48a8f100bad56d0b2846a61be3cd0b9bb0260616..521780ef0b41e9b60ea517bef22ce0b8a00920fe 100644 (file)
@@ -6,7 +6,7 @@ describe('joyride:', function() {
 
     var origFunc = $.fn.foundation;
     spyOn($.fn, 'foundation').andCallFake(function() {
-      var result = origFunc.apply(this);
+      var result = origFunc.apply(this, arguments);
       jasmine.Clock.tick(1000); // Let things settle...
       return result;
     });
index a202c561b278682e5a1c7e7057730ae1955b0a54..64af8825826be760f60f3a5e94487c8af6bc7379 100644 (file)
@@ -6,7 +6,7 @@ describe('magellan:', function() {
 
     var origFunc = $.fn.foundation;
     spyOn($.fn, 'foundation').andCallFake(function() {
-      var result = origFunc.apply(this);
+      var result = origFunc.apply(this, arguments);
       jasmine.Clock.tick(1000); // Let things settle...
       return result;
     });
index 484e89691960ddb59be3fea5b4c41aa2552c8432..6528620bf76e6cffb6a4552a1dddc7340a2374f3 100644 (file)
@@ -6,7 +6,7 @@ describe('offcanvas:', function() {
 
     var origFunc = $.fn.foundation;
     spyOn($.fn, 'foundation').andCallFake(function() {
-      var result = origFunc.apply(this);
+      var result = origFunc.apply(this, arguments);
       jasmine.Clock.tick(1000); // Let things settle...
       return result;
     });
index 1b39c4facbf915b0634bcc20022266f89d81a0f6..ad19a593043a95716e3bceded69a8fa042e9546f 100644 (file)
@@ -6,7 +6,7 @@ describe('orbit:', function() {
 
     var origFunc = $.fn.foundation;
     spyOn($.fn, 'foundation').andCallFake(function() {
-      var result = origFunc.apply(this);
+      var result = origFunc.apply(this, arguments);
       jasmine.Clock.tick(1000); // Let things settle...
       return result;
     });
index f03cfea11dd8c0ceed4ca4c664c48ea472cd5ba1..5e506682350c2fcdf3cee8458bc3f9be6357bc1c 100644 (file)
@@ -6,7 +6,7 @@ describe('reveal:', function() {
 
     var origFunc = $.fn.foundation;
     spyOn($.fn, 'foundation').andCallFake(function() {
-      var result = origFunc.apply(this);
+      var result = origFunc.apply(this, arguments);
       jasmine.Clock.tick(1000); // Let things settle...
       return result;
     });
index 2595f26bcfd031c19957da12657f0a265a833556..ebe8f5da7131a61c47d2fd1ca3c7060274c61c7a 100644 (file)
@@ -6,7 +6,7 @@ describe('tab:', function() {
 
     var origFunc = $.fn.foundation;
     spyOn($.fn, 'foundation').andCallFake(function() {
-      var result = origFunc.apply(this);
+      var result = origFunc.apply(this, arguments);
       jasmine.Clock.tick(1000); // Let things settle...
       return result;
     });
index 70b4124c411f1015d9bedd0b309112838cd26d01..2acce3ca6d8ae8cdf0c1719caa55540394492993 100644 (file)
@@ -6,7 +6,7 @@ describe('tooltip:', function() {
 
     var origFunc = $.fn.foundation;
     spyOn($.fn, 'foundation').andCallFake(function() {
-      var result = origFunc.apply(this);
+      var result = origFunc.apply(this, arguments);
       jasmine.Clock.tick(1000); // Let things settle...
       return result;
     });
index a334ac8e3060eefe993534b4ef42d7dbaea424ab..9bd1c93fb1e6674af7147c06386d2f90e215bec6 100644 (file)
@@ -6,7 +6,7 @@ describe('topbar:', function() {
 
     var origFunc = $.fn.foundation;
     spyOn($.fn, 'foundation').andCallFake(function() {
-      var result = origFunc.apply(this);
+      var result = origFunc.apply(this, arguments);
       jasmine.Clock.tick(1000); // Let things settle...
       return result;
     });