mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-25 10:50:22 +00:00
45 lines
1 KiB
JavaScript
45 lines
1 KiB
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Matchers for implementing specs. Follows the Jasmine spec conventions.
|
|
*/
|
|
|
|
angular.scenario.matcher('toEqual', function(expected) {
|
|
return angular.equals(this.actual, expected);
|
|
});
|
|
|
|
angular.scenario.matcher('toBe', function(expected) {
|
|
return this.actual === expected;
|
|
});
|
|
|
|
angular.scenario.matcher('toBeDefined', function() {
|
|
return angular.isDefined(this.actual);
|
|
});
|
|
|
|
angular.scenario.matcher('toBeTruthy', function() {
|
|
return this.actual;
|
|
});
|
|
|
|
angular.scenario.matcher('toBeFalsy', function() {
|
|
return !this.actual;
|
|
});
|
|
|
|
angular.scenario.matcher('toMatch', function(expected) {
|
|
return new RegExp(expected).test(this.actual);
|
|
});
|
|
|
|
angular.scenario.matcher('toBeNull', function() {
|
|
return this.actual === null;
|
|
});
|
|
|
|
angular.scenario.matcher('toContain', function(expected) {
|
|
return includes(this.actual, expected);
|
|
});
|
|
|
|
angular.scenario.matcher('toBeLessThan', function(expected) {
|
|
return this.actual < expected;
|
|
});
|
|
|
|
angular.scenario.matcher('toBeGreaterThan', function(expected) {
|
|
return this.actual > expected;
|
|
});
|