2019-09-20 14:39:20 +00:00
|
|
|
import './index.js';
|
|
|
|
|
|
|
|
describe('vnItemBasicData', () => {
|
|
|
|
describe('Component vnItemBasicData', () => {
|
|
|
|
let $scope;
|
|
|
|
let controller;
|
|
|
|
let $timeout;
|
|
|
|
|
2019-10-24 22:53:53 +00:00
|
|
|
beforeEach(ngModule('item'));
|
2019-09-20 14:39:20 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|