/
githubmirror
/
angular.js
Обзор
Документация
Войти
/
githubmirror
/
angular.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v1.6.1
test/ngScenario/mocks.js
33 строки
874 B
Josh Soref
docs(*): fix typos
29 окт 2016, 18:40
29 окт 2016, 18:40
5cce6e2
Код
Авторство
О чём код?
'use strict'; angular.scenario.testing = angular.scenario.testing || {}; angular.scenario.testing.MockAngular = function() { this.reset(); this.element = jqLite; }; angular.scenario.testing.MockAngular.prototype.reset = function() { this.log = []; }; angular.scenario.testing.MockAngular.prototype.poll = function() { this.log.push('$browser.poll()'); return this; }; angular.scenario.testing.MockRunner = function() { this.listeners = []; }; angular.scenario.testing.MockRunner.prototype.on = function(eventName, fn) { this.listeners[eventName] = this.listeners[eventName] || []; this.listeners[eventName].push(fn); }; angular.scenario.testing.MockRunner.prototype.emit = function(eventName) { var args = Array.prototype.slice.call(arguments, 1); angular.forEach(this.listeners[eventName] || [], function(fn) { fn.apply(this, args); }); };