mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
improved Testing README
This commit is contained in:
parent
5705d909e5
commit
fb25a1c503
15
README.md
15
README.md
@ -1,14 +1,23 @@
|
||||
#Building the KineticJS library
|
||||
To build the library, you need to have Ruby and Rubygems installed. After that, run `gem install thor`, `gem install json_pure`, and `gem install uglifier` to install the dependencies.
|
||||
|
||||
To build a development version of the library, run `thor build:dev VERSION`, where VERSION is a string that can be anything you like. For example, using `thor build:dev current` will produce `kinetic-current.js`. To build a minified version of the library, run `thor build:prod VERSION`.
|
||||
To build a development version of the library, run `thor build:dev VERSION`, where VERSION is a string that can be anything you like. For example, using `thor build:dev current` will produce `kinetic-vcurrent.js`. To build a minified version of the library, run `thor build:prod VERSION`.
|
||||
|
||||
If you add a file in the src directory, be sure to add the filename to the filename array in the Thorfile.
|
||||
|
||||
#Testing
|
||||
To run unit tests, you'll need to build the `unitTests.js` file by running `thor build:test` and then opening `unitTests.html`. You can navigate to all of the test suites by opening up `tests/html/index.html`. Unit, functional, and performance tests output the results to the console via `console.log()` so be sure to have it open.
|
||||
|
||||
To add / modify unit tests, be sure to do so in the `tests/js/unit` directory, because these are the source test files that are concatenated together when building `unitTests.js`. Use `test()` for hard tests which will throw an error if something fails, and use `warn()` for soft tests that will allow the tests to continue if the test condition fails. The `warn()` method is great for tests that will have different results in different browsers, such as canvas data url comparisons, text metric dimensions, etc. All tests should pass in Google Chrome with no warnings, and all tests should pass with some warnings in other browsers. Also, in order for data url tests and image manipulation tests to pass, you need to run the unit test suite on a web server.
|
||||
## Getting the tests up and running
|
||||
Currently, KineticJS has unit, functional, performance, manual, and special test suites. To build the unit tests, you'll need to build the `unitTests.js` file by running `thor build:test` and then opening `unitTests.html`. Open `tests/html/index.html` to navigate to different test suites.
|
||||
|
||||
## Running the tests
|
||||
Unit, functional, and performance tests output the results to the console via `console.log()` so be sure to have it open.
|
||||
|
||||
In order for the data url tests and image manipulation tests to pass, you need to run the unit test suite on a web server due to canvas security constraints ([read more about that here](http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#security-with-canvas-elements)). All tests should pass in Google Chrome with no warnings, and all tests should pass with some warnings in other browsers.
|
||||
|
||||
## Updating the tests
|
||||
|
||||
To add / modify unit tests, be sure to do so in the `tests/js/unit` directory, because these are the source test files that are concatenated together when building `unitTests.js`. Use `test()` for hard tests which will throw an error if something fails, and use `warn()` for soft tests that will allow the tests to continue if the test condition fails. The `warn()` method is great for tests that will have different results in different browsers, such as canvas data url comparisons, text metric dimensions, etc.
|
||||
|
||||
TIP: prepend a test name with a `*` to only run that particular test, or prepend a test name with `!` to omit that test.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user