OLD | NEW |
(Empty) | |
| 1 # Testing Adblock Plus UI Components |
| 2 |
| 3 All components should have a corresponding |
| 4 _component-name.html_ file to reach and test |
| 5 via all our target browsers. |
| 6 |
| 7 Such file should contain all the necessary to |
| 8 bootstrap ABP UI like environment and test such component. |
| 9 |
| 10 |
| 11 ## component-name.test.js |
| 12 |
| 13 This should be file loaded, as deferred, at the bottom |
| 14 of _component-name.html_ scripts list. |
| 15 |
| 16 The file should, at least, include the component it's testing. |
| 17 |
| 18 Example: |
| 19 |
| 20 ```js |
| 21 /* globals module, require */ |
| 22 |
| 23 "use strict"; |
| 24 |
| 25 const IOParagraph = require("../js/io-paragraph"); |
| 26 |
| 27 document.body.appendChild( |
| 28 new IOParagraph("some content") |
| 29 ); |
| 30 ``` |
| 31 |
| 32 |
| 33 ## bundle & test via package.json |
| 34 |
| 35 Once there is a `.test` file, ensure it's built properly |
| 36 like it is, as example, for the `test:io-element.js` case. |
| 37 |
| 38 Ensure the built target is, as example, `tests/io-paragraph.js`, |
| 39 and add `npm run test:io-paragraph.js` to the generic |
| 40 `test` entry in the _package.json_ file. |
| 41 |
| 42 `npm test` should build and bundle all tests, but we want |
| 43 to be able to test a single component too. |
| 44 |
| 45 |
| 46 ## test on browsers |
| 47 Simply run `npm start` and reach `localhost:XXXX/tests` folder |
| 48 with all target browsers you need to verify the component. |
OLD | NEW |