|
| 1 | +//------------------------------------------------------------------------------ |
| 2 | +// Requirements |
| 3 | +//------------------------------------------------------------------------------ |
| 4 | + |
| 5 | +var eslint = require('../node_modules/eslint/lib/eslint'), |
| 6 | + ESLintTester = require('eslint-tester'); |
| 7 | + |
| 8 | +//------------------------------------------------------------------------------ |
| 9 | +// Tests |
| 10 | +//------------------------------------------------------------------------------ |
| 11 | + |
| 12 | +var eslintTester = new ESLintTester(eslint); |
| 13 | +eslintTester.addRuleTest('rules/ng_watchers_execution', { |
| 14 | + valid: [ |
| 15 | + {code: '$scope.$apply(function(){})', args: [1, '$apply']}, |
| 16 | + {code: '$rootScope.$apply(function(){})', args: [1, '$apply']}, |
| 17 | + {code: '$scope.$digest()', args: [1, '$digest']}, |
| 18 | + {code: '$rootScope.$digest()', args: [1, '$digest']} |
| 19 | + ], |
| 20 | + invalid: [ |
| 21 | + {code: '$scope.$apply(function(){})', args: [1, '$digest'], errors: [{ message: 'Instead of using the $apply() method, you should prefer $digest()'}]}, |
| 22 | + {code: '$rootScope.$apply(function(){})', args: [1, '$digest'], errors: [{ message: 'Instead of using the $apply() method, you should prefer $digest()'}]}, |
| 23 | + {code: '$scope.$digest()', args: [1, '$apply'], errors: [{ message: 'Instead of using the $digest() method, you should prefer $apply()'}]}, |
| 24 | + {code: '$rootScope.$digest()', args: [1, '$apply'], errors: [{ message: 'Instead of using the $digest() method, you should prefer $apply()'}]} |
| 25 | + ] |
| 26 | +}); |
0 commit comments