forked from intel/appframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial tests for getCssMatrix()
- Loading branch information
1 parent
74d8c76
commit 9718bd6
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
require("./chai.helper"); | ||
var sinon = require("sinon"); | ||
var domHelper = require("./dom.helper"); | ||
|
||
describe("getCssMatrix", function () { | ||
var stubMatrix = { a: 1, b: 1, c: 1, d: 1, e: 1, f: 1 }; | ||
|
||
// matrix for 90deg rotate | ||
var stubWebkitCssMatrix = "matrix(0, 1, -1, 0, 0, 0)"; | ||
|
||
// matrix for 180deg rotate | ||
var stubMsCssMatrix = "matrix(-1, 0, 0, -1, 0, 0)"; | ||
|
||
// matrix for 270deg rotate | ||
var stubFooCssMatrix = "matrix(0, -1, 1, 0, 0, 0)"; | ||
|
||
beforeEach(function () { | ||
domHelper( | ||
"<div id=\"moo\"></div>" | ||
); | ||
}); | ||
|
||
it("should return a default matrix if no element argument passed", function () { | ||
var matrix = $.getCssMatrix(); | ||
var expected = { a: 0, b: 0, c: 0, d: 0, e: 0, f: 0 }; | ||
matrix.should.eql(expected); | ||
}); | ||
|
||
it("should return a default matrix for an element if an exception occurs", function () { | ||
var stub = sinon.stub(window, "getComputedStyle").throws(); | ||
var expected = { a: 0, b: 0, c: 0, d: 0, e: 0, f: 0 }; | ||
var elt = document.getElementById("moo"); | ||
var matrix = $.getCssMatrix(elt); | ||
matrix.should.eql(expected); | ||
}); | ||
|
||
}); |