2018-09-07 10:20:57 +00:00
|
|
|
import './index.js';
|
|
|
|
import template from './index.html';
|
|
|
|
|
|
|
|
describe('Component vnChip', () => {
|
|
|
|
let $element;
|
|
|
|
let $scope;
|
|
|
|
let controller;
|
|
|
|
|
2019-09-13 14:09:14 +00:00
|
|
|
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
|
|
|
$translateProvider.translations('en', {});
|
|
|
|
}));
|
2018-09-07 10:20:57 +00:00
|
|
|
|
2018-12-22 10:59:26 +00:00
|
|
|
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
2018-09-07 10:20:57 +00:00
|
|
|
$scope = $rootScope.$new();
|
|
|
|
$element = angular.element(`<div>${template}</div>`);
|
2018-12-22 10:59:26 +00:00
|
|
|
controller = $componentController('vnChip', {$element, $scope, $transclude: () => {}});
|
2018-09-07 10:20:57 +00:00
|
|
|
}));
|
|
|
|
|
2019-10-18 19:36:30 +00:00
|
|
|
describe('onRemove()', () => {
|
|
|
|
it(`should emit remove event`, () => {
|
|
|
|
controller.emit = () => {};
|
|
|
|
spyOn(controller, 'emit');
|
|
|
|
controller.onRemove();
|
2018-09-07 10:20:57 +00:00
|
|
|
|
2019-10-18 19:36:30 +00:00
|
|
|
expect(controller.emit).toHaveBeenCalledWith('remove');
|
2018-09-07 10:20:57 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|