Skip to content
Browse files

Add fullscreen.element(), expand fullscreen test suite.

  • Loading branch information...
1 parent ef169c0 commit 95f6f9c5102a321e39b181436fca821ac770141b @tmcw tmcw committed
Showing with 30 additions and 2 deletions.
  1. +4 −0 control/mm/fullscreen.js
  2. +26 −2 test/spec/fullscreen.js
View
4 control/mm/fullscreen.js
@@ -72,6 +72,10 @@ wax.mm.fullscreen = function() {
return fullscreen;
};
+ fullscreen.element = function() {
+ return a;
+ };
+
fullscreen.appendTo = function(elem) {
wax.u.$(elem).appendChild(a);
return fullscreen;
View
28 test/spec/fullscreen.js
@@ -1,5 +1,5 @@
describe('fullscreen', function() {
- var map;
+ var map, fullscreen;
beforeEach(function() {
callbackResult = null;
@@ -10,7 +10,7 @@ describe('fullscreen', function() {
map = new MM.Map(div, new MM.TemplatedMapProvider(
'http://{S}tile.openstreetmap.org/{Z}/{X}/{Y}.png', ['a.']));
map.setCenterZoom(new MM.Location(37.811530, -122.2666097), 10);
- wax.mm.fullscreen().map(map).add();
+ fullscreen = wax.mm.fullscreen().map(map).add();
});
it('makes the map fullscreen', function() {
@@ -24,4 +24,28 @@ describe('fullscreen', function() {
$('.map-fullscreen', map.parent).click();
expect($(map.parent).hasClass('map-fullscreen-map')).toEqual(false);
});
+
+ it('provides its dom element', function() {
+ expect(jasmine.isDomNode(fullscreen.element())).toEqual(true);
+ });
+
+ it('can be appended to another element', function() {
+ var div = document.createElement('div');
+ expect(fullscreen.appendTo(div)).toEqual(fullscreen);
+ expect(fullscreen.element().parentNode).toEqual(div);
+ });
+
+ it('can repeatedly make things fullscreen and not fullscreen', function() {
+ fullscreen.full();
+ fullscreen.full();
+ fullscreen.full();
+ fullscreen.original();
+ fullscreen.original();
+ fullscreen.original();
+ });
+
+ it('can be added and removed', function() {
+ expect(fullscreen.add()).toEqual(fullscreen);
+ expect(fullscreen.remove()).toEqual(fullscreen);
+ });
});

0 comments on commit 95f6f9c

Please sign in to comment.
Something went wrong with that request. Please try again.