Add unit test to detect the "unwanted draw point"
[dygraphs.git] / DEVELOP.md
1 ## dygraphs developer notes
2
3 So you've made a change to dygraphs and would like to contribute it back to the open source project. Wonderful!
4
5 This is a step-by-step guide explaining how to do it.
6
7 ### How-to
8
9 To build dygraphs, run
10
11     npm run build
12
13 To run the tests, run:
14
15     npm run build-tests
16     npm run test
17
18 To iterate on the code, run:
19
20     npm run watch
21
22 and open `tests/demo.html` (or one of the other demos) in your browser.
23
24 To iterate on a unit test, run the `watch` command above and open
25
26     auto_tests/runner.html
27
28 in your browser. You can use the Mocha UI to run just a single test or suite.
29 Or you can change `it` to `it.only` to do run just one test in code.
30
31 To run a single test from the command line, you can use:
32
33   npm run test -- --grep highlight-series-background
34
35 (Note the extra `--`.)
36
37 ### dygraphs style
38
39 When making a change, please try to follow the style of the existing dygraphs code. This will make the review process go much more smoothly.
40
41 A few salient points:
42
43 1. We try to adhere to Google's [JS style guide][gstyle] and would appreciate it if you try to as well. This means:
44   *   No tabs! Indent using two spaces.
45   *   Use camelCase for variable and function names.
46   *   Limit lines to 80 characters.
47 1.  If you've added a new feature, add a test for it (in the tests/ directory) or a gallery entry.
48 1.  If you've added an option, document it in `dygraph-options-reference.js`. You'll get lots of warnings if you don't.
49 1.  If you've fixed a bug or added a feature, add a unit test (in `auto_tests`) for it.
50
51 Adding a unit test ensures that we won't inadvertently break your feature in the future. To do this, either add to an existing test in `auto_tests/tests` or create a new one.
52
53 ### Sending a Pull Request
54
55 To make a change, you'll need to send a Pull Request. See GitHub's documentation [here][pr].
56
57 [gstyle]: http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml
58 [pr]: http://help.github.com/send-pull-requests/