Skip to content
Extraits de code Groupes Projets
Valider fbd208a6 rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

refs #5983 updated docs for test file naming as suggested by AngularJs style guide

parent 3cb62580
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -17,11 +17,11 @@ On Ubuntu you might be able to use the `scripts/install-ubuntu.sh` script. Have ...@@ -17,11 +17,11 @@ On Ubuntu you might be able to use the `scripts/install-ubuntu.sh` script. Have
## File structure ## File structure
We do not have a general `tests` folder containing all test files. Instead we create a file having the same name appended by `_spec.js` in the same directory. We do not have a general `tests` folder containing all test files. Instead we create a file having the same name appended by `.spec.js` in the same directory.
For instance you want to test a file named `startfrom.js` then we create a file named `startfrom_spec.js`: For instance you want to test a file named `startfrom.js` then we create a file named `startfrom.spec.js`:
`plugins/CoreHome/angularjs/common/filters/startfrom.js` => `plugins/CoreHome/angularjs/common/filters/startfrom.js` =>
`plugins/CoreHome/angularjs/common/filters/startfrom_spec.js` `plugins/CoreHome/angularjs/common/filters/startfrom.spec.js`
## Execution ## Execution
...@@ -44,7 +44,7 @@ Before executing a test it'll always run [JSHint](http://www.jshint.com/) to det ...@@ -44,7 +44,7 @@ Before executing a test it'll always run [JSHint](http://www.jshint.com/) to det
Just in case you want to write a test for your jQuery code you can do this the same way. You might be interested in the [Chai jQuery](http://chaijs.com/plugins/chai-jquery) plugin. Just in case you want to write a test for your jQuery code you can do this the same way. You might be interested in the [Chai jQuery](http://chaijs.com/plugins/chai-jquery) plugin.
## Examples ## Examples
* [Testing a filter](../../plugins/CoreHome/angularjs/common/filters/startfrom_spec.js) * [Testing a filter](../../plugins/CoreHome/angularjs/common/filters/startfrom.spec.js)
* [Testing a directive](../../plugins/CoreHome/angularjs/common/directives/autocomplete-matched_spec.js) * [Testing a directive](../../plugins/CoreHome/angularjs/common/directives/autocomplete-matched.spec.js)
* [Testing a service/provider/factory/model](../../plugins/CoreHome/angularjs/common/services/piwik_spec.js) * [Testing a service/provider/factory/model](../../plugins/CoreHome/angularjs/common/services/piwik.spec.js)
* See more examples in [AngularJS guide](http://docs.angularjs.org/guide/unit-testing) * See more examples in [AngularJS guide](http://docs.angularjs.org/guide/unit-testing)
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter