merge
This commit is contained in:
commit
ef2e80cbad
|
@ -11,9 +11,12 @@ describe('Component vnClientBillingData', () => {
|
|||
beforeEach(angular.mock.inject(function(_$componentController_, $rootScope) {
|
||||
$componentController = _$componentController_;
|
||||
$scope = $rootScope.$new();
|
||||
// try to instanciate the actual watcher instead of submit spy usage.
|
||||
// should add instanciate of actual watcher instead of submit() spy usage.
|
||||
let submit = jasmine.createSpy('submit').and.returnValue(Promise.resolve());
|
||||
// should add instanciate of actual sendMail instead of show() spy usage.
|
||||
let show = jasmine.createSpy('show');
|
||||
$scope.watcher = {submit};
|
||||
$scope.sendMail = {show};
|
||||
}));
|
||||
|
||||
describe('copyData()', () => {
|
||||
|
@ -45,4 +48,23 @@ describe('Component vnClientBillingData', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('checkPaymentChanges()', () => {
|
||||
it(`should not call sendMail.show() if there are no changes on billing data`, () => {
|
||||
let controller = $componentController('vnClientBillingData', {$scope: $scope});
|
||||
controller.billData = {marvelHero: 'Silver Surfer'};
|
||||
controller.client = {marvelHero: 'Silver Surfer'};
|
||||
controller.checkPaymentChanges();
|
||||
expect(controller.$.sendMail.show).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it(`should call sendMail.show() if there are changes on billing data`, () => {
|
||||
let controller = $componentController('vnClientBillingData', {$scope: $scope});
|
||||
controller.billData = {marvelHero: 'Silver Surfer'};
|
||||
controller.client = {marvelHero: 'Spider-Man'};
|
||||
controller.checkPaymentChanges();
|
||||
expect(controller.$.sendMail.show).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue