This commit is contained in:
parent
b0e5b46245
commit
7bcc908708
|
@ -0,0 +1,3 @@
|
||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`vnItemBasicData Component vnItemBasicData $onChanges() should pass the data to the watcher 1`] = `"the current value of an item"`;
|
|
@ -0,0 +1,30 @@
|
||||||
|
import './index.js';
|
||||||
|
|
||||||
|
describe('vnItemBasicData', () => {
|
||||||
|
describe('Component vnItemBasicData', () => {
|
||||||
|
let $scope;
|
||||||
|
let controller;
|
||||||
|
let $timeout;
|
||||||
|
|
||||||
|
beforeEach(angular.mock.module('item', $translateProvider => {
|
||||||
|
$translateProvider.translations('en', {});
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(angular.mock.inject(($componentController, $rootScope, _$timeout_) => {
|
||||||
|
$timeout = _$timeout_;
|
||||||
|
$scope = $rootScope.$new();
|
||||||
|
controller = $componentController('vnItemBasicData', {$scope, $timeout});
|
||||||
|
controller.$scope.watcher = {};
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('$onChanges()', () => {
|
||||||
|
it('should pass the data to the watcher', () => {
|
||||||
|
const data = {item: {currentValue: 'the current value of an item'}};
|
||||||
|
controller.$onChanges(data);
|
||||||
|
$timeout.flush();
|
||||||
|
|
||||||
|
expect(controller.$scope.watcher.data).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue