diff --git a/modules/client/front/sample/create/index.spec.js b/modules/client/front/sample/create/index.spec.js index de15e8a3c..efcda5401 100644 --- a/modules/client/front/sample/create/index.spec.js +++ b/modules/client/front/sample/create/index.spec.js @@ -4,6 +4,7 @@ describe('Client', () => { describe('Component vnClientSampleCreate', () => { let $httpParamSerializer; let $scope; + let $element; let $httpBackend; let $state; let controller; @@ -37,12 +38,13 @@ describe('Client', () => { $state.params.id = 101; $httpBackend = _$httpBackend_; $httpParamSerializer = _$httpParamSerializer_; - controller = $componentController('vnClientSampleCreate', {$scope, $state}); + $element = angular.element(''); + controller = $componentController('vnClientSampleCreate', {$element, $scope}); })); describe('showPreview()', () => { it(`should perform a query (GET) and open a sample preview`, () => { - spyOn(controller.$scope.showPreview, 'show'); + spyOn(controller.$.showPreview, 'show'); const element = document.createElement('div'); document.body.querySelector = () => { return { @@ -52,7 +54,7 @@ describe('Client', () => { }; }; - controller.$scope.sampleType.selection = { + controller.$.sampleType.selection = { hasCompany: false, code: 'MyReport' }; @@ -74,11 +76,11 @@ describe('Client', () => { controller.showPreview(event); $httpBackend.flush(); - expect(controller.$scope.showPreview.show).toHaveBeenCalledWith(); + expect(controller.$.showPreview.show).toHaveBeenCalledWith(); }); it(`should perform a query (GET) with companyFk param and open a sample preview`, () => { - spyOn(controller.$scope.showPreview, 'show'); + spyOn(controller.$.showPreview, 'show'); const element = document.createElement('div'); document.body.querySelector = () => { return { @@ -88,7 +90,7 @@ describe('Client', () => { }; }; - controller.$scope.sampleType.selection = { + controller.$.sampleType.selection = { hasCompany: true, code: 'MyReport' }; @@ -112,7 +114,7 @@ describe('Client', () => { controller.showPreview(event); $httpBackend.flush(); - expect(controller.$scope.showPreview.show).toHaveBeenCalledWith(); + expect(controller.$.showPreview.show).toHaveBeenCalledWith(); }); }); @@ -129,7 +131,7 @@ describe('Client', () => { it(`should perform a query (GET) and call go() method`, () => { spyOn(controller.$state, 'go'); - controller.$scope.sampleType.selection = { + controller.$.sampleType.selection = { hasCompany: false, code: 'MyReport' }; @@ -154,7 +156,7 @@ describe('Client', () => { it(`should perform a query (GET) with companyFk param and call go() method`, () => { spyOn(controller.$state, 'go'); - controller.$scope.sampleType.selection = { + controller.$.sampleType.selection = { hasCompany: true, code: 'MyReport' };