From f2c1227319bda95a81545ef93e67cb4d3467e470 Mon Sep 17 00:00:00 2001 From: Mike Cousins Date: Sat, 25 Jun 2016 17:00:36 -0400 Subject: [PATCH] Initial release of viewbox --- API.md | 37 ++++++++++++++++++++++++++++++++++++- package.json | 2 +- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/API.md b/API.md index 35e2d2e..ad25b64 100644 --- a/API.md +++ b/API.md @@ -4,7 +4,7 @@ # viewbox -should be able to create a new empty viewbox. +should be able to create a new viewbox. ```js var result = viewbox.create() @@ -72,3 +72,38 @@ expect(result).to.eql({ }) ``` +should output a 0 size rectangle for something falsey. + +```js +var result = viewbox.rect() +expect(result).to.eql({ + x: 0, + y: 0, + width: 0, + height: 0 +}) +``` + +should be able to generate a viewbox string. + +```js +var box = [1, 2, 3, 4] +var result = viewbox.asString(box) +expect(result).to.equal('1 2 3 4') +``` + +should output a new viewbox as a 0 size viewbox string. + +```js +var box = viewbox.create() +var result = viewbox.asString(box) +expect(result).to.equal('0 0 0 0') +``` + +should output something falsey as a 0 size viewbox string. + +```js +var result = viewbox.asString() +expect(result).to.equal('0 0 0 0') +``` + diff --git a/package.json b/package.json index 156c3e8..7b9ca3a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "viewbox", - "version": "0.0.0", + "version": "1.0.0", "description": "Library for dealing with SVG viewboxes as plain arrays", "main": "index.js", "directories": {