]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Update dropdown automated tests to work with new positioning 10053/head
authorKevin Ball <kmball11@gmail.com>
Wed, 31 May 2017 22:34:15 +0000 (15:34 -0700)
committerKevin Ball <kmball11@gmail.com>
Wed, 31 May 2017 22:34:15 +0000 (15:34 -0700)
test/javascript/components/dropdown.js

index ee0da373eb578a6cf6c4ace28417d284ff6436f4..6a7e029fc5b7166c9fa1a7255baca247315bb00c 100644 (file)
@@ -56,40 +56,25 @@ describe('Dropdown', function() {
     });
   });
 
-  describe('getPositionClass()', function() {
-    it('has no orientation', function() {
+  describe('inferred positioning', function() {
+    it('default orientation should be bottom', function() {
       $dropdownController = $(getDropdownController()).appendTo('body');
       $dropdownContainer = $(getDropdownContainer()).appendTo('body');
       plugin = new Foundation.Dropdown($dropdownContainer, {});
 
-      plugin.getPositionClass().trim().should.equal('');
+      plugin.open()
+      plugin.position.should.equal('bottom');
     });
 
-    it('has vertical position', function() {
-      $dropdownController = $(getDropdownController()).appendTo('body');
-      $dropdownContainer = $(getDropdownContainer('custom-style-before bottom custom-style-after'))
-        .appendTo('body');
-      plugin = new Foundation.Dropdown($dropdownContainer, {});
-
-      plugin.getPositionClass().trim().should.equal('bottom');
-    });
-
-    it('has horizontal position', function() {
+    it('gets right alignment from float-right', function() {
       $dropdownController = $(getDropdownController('custom-style-before float-right custom-style-after'))
         .appendTo('body');
       $dropdownContainer = $(getDropdownContainer()).appendTo('body');
       plugin = new Foundation.Dropdown($dropdownContainer, {});
 
-      plugin.getPositionClass().trim().should.equal('right');
-    });
-
-    it('has horizontal position and only one class', function() {
-      $dropdownController = $(getDropdownController('float-right'))
-        .appendTo('body');
-      $dropdownContainer = $(getDropdownContainer()).appendTo('body');
-      plugin = new Foundation.Dropdown($dropdownContainer, {});
-
-      plugin.getPositionClass().trim().should.equal('right');
+      plugin.open()
+      plugin.position.should.equal('bottom')
+      plugin.alignment.should.equal('right')
     });
   });
 });