Skip to content

Commit

Permalink
clear zoom / transform property if ratio is 1
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Sep 23, 2015
1 parent 487cc62 commit d5abde6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
6 changes: 3 additions & 3 deletions dist/bespoke-scale.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* bespoke-scale v1.0.1
*
* Copyright 2014, Mark Dalgleish
* Copyright 2015, Mark Dalgleish
* This content is released under the MIT license
* http://mit-license.org/markdalgleish
*/
Expand Down Expand Up @@ -34,10 +34,10 @@ module.exports = function(options) {

scale = useZoom ?
function(ratio, element) {
element.style.zoom = ratio;
element.style.zoom = ratio === 1 ? '' : ratio;
} :
function(ratio, element) {
element.style[transformProperty] = 'scale(' + ratio + ')';
element.style[transformProperty] = ratio === 1 ? '' : 'scale(' + ratio + ')';
},

scaleAll = function() {
Expand Down
4 changes: 2 additions & 2 deletions dist/bespoke-scale.min.js
100755 → 100644

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/bespoke-scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ module.exports = function(options) {

scale = useZoom ?
function(ratio, element) {
element.style.zoom = ratio;
element.style.zoom = ratio === 1 ? '' : ratio;
} :
function(ratio, element) {
element.style[transformProperty] = 'scale(' + ratio + ')';
element.style[transformProperty] = ratio === 1 ? '' : 'scale(' + ratio + ')';
},

scaleAll = function() {
Expand Down
17 changes: 14 additions & 3 deletions test/spec/bespoke-scaleSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe("bespoke-scale", function() {

describe("option value of '" + option + "'", function() {

describe("loading a 4x3 pressentation", function() {
describe("loading a 4x3 presentation", function() {

beforeEach(createDeck.bind(null, 1024, 768, option));

Expand Down Expand Up @@ -91,9 +91,20 @@ describe("bespoke-scale", function() {

});

describe("resizing the window to fit the slides", function() {
beforeEach(function() {
resize(deck.parent, 100, 100, option);
});

it ("should clear the scale property on each slide", function() {
expect(deck.slides[0].style.zoom).toBe('');
expect(deck.slides[0].style[transformProperty]).toBe('');
});
});

});

describe("loading a 16x9 pressentation", function() {
describe("loading a 16x9 presentation", function() {

beforeEach(createDeck.bind(null, 1280, 720, option));

Expand All @@ -103,7 +114,7 @@ describe("bespoke-scale", function() {

});

describe("loading a 3x4 pressentation", function() {
describe("loading a 3x4 presentation", function() {

beforeEach(createDeck.bind(null, 480, 640, option));

Expand Down

0 comments on commit d5abde6

Please sign in to comment.