Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolves #6 clear zoom / transform setting if ratio is 1 #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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