Skip to content
This repository has been archived by the owner on May 25, 2019. It is now read-only.

Commit

Permalink
Add three more unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Triangle717 committed Apr 4, 2015
1 parent 057fa90 commit 2f0e845
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Changes #

## 1.4.2 ##
### ? April, 2015 ###
* Add simple unit tests for `src/SvgSize` module
### 3 April, 2015 ###
* Add simple unit tests for `src/SvgSize` module (not included in distributed release)
* Fix regression in extracting values from SVG `enable-background` attribute

## 1.4.1 ##
Expand Down
1 change: 1 addition & 0 deletions unittest-files/svg/toolbar-line-height.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions unittest-files/svg/toolbar-stroke-width.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions unittest-files/svg/toolbar-whitespace.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 20 additions & 4 deletions unittests.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ define(function (require, exports, module) {
SvgAllProps = testPath + "toolbar-all-props.svg",
SvgWidthHeight = testPath + "toolbar-width-height.svg";

var SvgWhiteSpace = testPath + "toolbar-whitespace.svg",
SvgStrokeWidth = testPath + "toolbar-stroke-width.svg",
SvgLineHeight = testPath + "toolbar-line-height.svg";


function confirmDimensions(file, expectedSizes) {
var complete = false,
Expand All @@ -50,22 +54,34 @@ define(function (require, exports, module) {
});
}

it("should extract the width and height values from an SVG", function () {
it("should extract the width and height values", function () {
confirmDimensions(SvgWidthHeight, {width: "24", height: "24"});
});

it("should extract the viewBox values from an SVG", function () {
it("should extract the viewBox values", function () {
confirmDimensions(SvgViewBox, {width: "24", height: "24"});
});

it("should extract the enable-background values from an SVG", function () {
it("should extract the enable-background values", function () {
confirmDimensions(SvgEBack, {width: "24", height: "24"});
});

it("should extract the width and height values from an SVG containing all supported properties", function () {
it("should extract the width and height values when containing all supported properties", function () {
confirmDimensions(SvgAllProps, {width: "24", height: "24"});
});

it("should extract the width and height values without copious amounts of whitespace", function () {
confirmDimensions(SvgWhiteSpace, {width: "50", height: "50"});
});

it("should extract NOT extract the stroke-width value", function () {
confirmDimensions(SvgStrokeWidth, {width: "100", height: "100"});
});

it("should extract NOT extract the line-height value", function () {
confirmDimensions(SvgLineHeight, {width: "100", height: "100"});
});

});

});
Expand Down

0 comments on commit 2f0e845

Please sign in to comment.