Merge pull request '2233_global-refactor' (#341) from 2233_global-refactor into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #341 Reviewed-by: Bernat Exposito <bernat@verdnatura.es>
This commit is contained in:
commit
6504d0f5bc
|
@ -214,7 +214,7 @@ export default class ArrayModel extends ModelProxy {
|
|||
}
|
||||
ArrayModel.$inject = ['$q', '$filter', '$element', '$scope'];
|
||||
|
||||
ngModule.component('vnArrayModel', {
|
||||
ngModule.vnComponent('vnArrayModel', {
|
||||
controller: ArrayModel,
|
||||
bindings: {
|
||||
orgData: '<?',
|
||||
|
|
|
@ -192,7 +192,7 @@ export default class Autocomplete extends Field {
|
|||
|
||||
if (this.translateFields) {
|
||||
if (this.translateFields.indexOf(this.showField) > -1)
|
||||
this.input.value = this.$translate.instant(display);
|
||||
this.input.value = this.$t(display);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('Component vnChip', () => {
|
|||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
beforeEach(inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
$element = angular.element(`<div>${template}</div>`);
|
||||
controller = $componentController('vnChip', {$element, $scope, $transclude: () => {}});
|
||||
|
|
|
@ -272,7 +272,7 @@ export default class CrudModel extends ModelProxy {
|
|||
}
|
||||
CrudModel.$inject = ['$q', '$http', '$element', '$scope'];
|
||||
|
||||
ngModule.component('vnCrudModel', {
|
||||
ngModule.vnComponent('vnCrudModel', {
|
||||
controller: CrudModel,
|
||||
bindings: {
|
||||
orgData: '<?',
|
||||
|
|
|
@ -21,7 +21,7 @@ export default class DataViewer {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnDataViewer', {
|
||||
ngModule.vnComponent('vnDataViewer', {
|
||||
template: require('./index.html'),
|
||||
transclude: true,
|
||||
controller: DataViewer,
|
||||
|
|
|
@ -9,7 +9,7 @@ describe('Component vnDatePicker', () => {
|
|||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => {
|
||||
beforeEach(inject(($compile, $rootScope, _$filter_) => {
|
||||
$filter = _$filter_;
|
||||
|
||||
$element = $compile(`<vn-date-picker></vn-date-picker>`)($rootScope);
|
||||
|
|
|
@ -5,7 +5,7 @@ describe('Component vnDialog', () => {
|
|||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($rootScope, $compile) => {
|
||||
beforeEach(inject(($rootScope, $compile) => {
|
||||
$scope = $rootScope.$new();
|
||||
$element = $compile('<vn-dialog><tpl-body>Body</tpl-body></vn-dialog>')($scope);
|
||||
controller = $element.controller('vnDialog');
|
||||
|
|
|
@ -276,7 +276,7 @@ export default class DropDown extends Popover {
|
|||
if (this.translateFields) {
|
||||
option = Object.assign({}, option);
|
||||
for (let field of this.translateFields)
|
||||
option[field] = this.$translate.instant(option[field]);
|
||||
option[field] = this.$t(option[field]);
|
||||
}
|
||||
|
||||
let li = this.document.createElement('li');
|
||||
|
|
|
@ -25,7 +25,7 @@ class Icon {
|
|||
}
|
||||
Icon.$inject = ['$attrs'];
|
||||
|
||||
ngModule.component('vnIcon', {
|
||||
ngModule.vnComponent('vnIcon', {
|
||||
template: '<i class="{{::$ctrl.iconClass}} unselectable">{{::$ctrl.iconContent}}</i>',
|
||||
controller: Icon,
|
||||
bindings: {
|
||||
|
|
|
@ -7,7 +7,7 @@ describe('Component vnInputFile', () => {
|
|||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($compile, $rootScope) => {
|
||||
beforeEach(inject(($compile, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
$element = $compile('<vn-input-file></vn-input-file>')($scope);
|
||||
controller = $element.controller('vnInputFile');
|
||||
|
|
|
@ -6,7 +6,7 @@ describe('Component vnInputNumber', () => {
|
|||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($compile, $rootScope) => {
|
||||
beforeEach(inject(($compile, $rootScope) => {
|
||||
$element = $compile(`<vn-input-number ng-model="model" />`)($rootScope);
|
||||
$ctrl = $element.controller('vnInputNumber');
|
||||
}));
|
||||
|
|
|
@ -7,7 +7,7 @@ describe('Component vnInputTime', () => {
|
|||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => {
|
||||
beforeEach(inject(($compile, $rootScope, _$filter_) => {
|
||||
$filter = _$filter_;
|
||||
|
||||
$element = $compile(`<vn-input-time></vn-input-time>`)($rootScope);
|
||||
|
|
|
@ -42,7 +42,7 @@ export default class Controller extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnLabelValue', {
|
||||
ngModule.vnComponent('vnLabelValue', {
|
||||
controller: Controller,
|
||||
template: require('./index.html'),
|
||||
transclude: true,
|
||||
|
|
|
@ -30,7 +30,7 @@ export class DataModel extends Component {
|
|||
clear() {}
|
||||
}
|
||||
|
||||
ngModule.component('vnDataModel', {
|
||||
ngModule.vnComponent('vnDataModel', {
|
||||
controller: DataModel,
|
||||
bindings: {
|
||||
data: '=?',
|
||||
|
@ -269,7 +269,7 @@ export default class ModelProxy extends DataModel {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnModelProxy', {
|
||||
ngModule.vnComponent('vnModelProxy', {
|
||||
controller: ModelProxy,
|
||||
bindings: {
|
||||
orgData: '<?',
|
||||
|
|
|
@ -114,7 +114,7 @@ export default class MultiCheck extends FormInput {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnMultiCheck', {
|
||||
ngModule.vnComponent('vnMultiCheck', {
|
||||
template: require('./multi-check.html'),
|
||||
controller: MultiCheck,
|
||||
bindings: {
|
||||
|
|
|
@ -7,7 +7,7 @@ describe('Component vnMultiCheck', () => {
|
|||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject($componentController => {
|
||||
beforeEach(inject($componentController => {
|
||||
$element = angular.element(`<div class="shown"></div>`);
|
||||
controller = $componentController('vnMultiCheck', {$element: $element});
|
||||
controller._model = crudModel;
|
||||
|
|
|
@ -90,7 +90,7 @@ class Pagination extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnPagination', {
|
||||
ngModule.vnComponent('vnPagination', {
|
||||
template: require('./pagination.html'),
|
||||
bindings: {
|
||||
model: '<',
|
||||
|
|
|
@ -22,7 +22,7 @@ export default class Controller extends Component {
|
|||
|
||||
Controller.$inject = ['$element', '$scope', '$window'];
|
||||
|
||||
ngModule.component('vnScrollUp', {
|
||||
ngModule.vnComponent('vnScrollUp', {
|
||||
template: require('./scroll-up.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -36,7 +36,7 @@ export default class Searchbar extends Component {
|
|||
}
|
||||
|
||||
this.searchState = `${this.baseState}.index`;
|
||||
this.placeholder = this.$translate.instant('Search by', {
|
||||
this.placeholder = this.$t('Search by', {
|
||||
module: this.baseState
|
||||
});
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ export default class Portal {
|
|||
}
|
||||
Portal.$inject = ['$transclude', 'vnSlotService'];
|
||||
|
||||
ngModule.component('vnPortal', {
|
||||
ngModule.vnComponent('vnPortal', {
|
||||
controller: Portal,
|
||||
transclude: true,
|
||||
bindings: {
|
||||
|
|
|
@ -144,7 +144,7 @@ export default class Controller extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnSnackbar', {
|
||||
ngModule.vnComponent('vnSnackbar', {
|
||||
template: require('./snackbar.html'),
|
||||
controller: Controller
|
||||
});
|
||||
|
|
|
@ -54,4 +54,4 @@ export const component = {
|
|||
},
|
||||
controller: Spinner
|
||||
};
|
||||
ngModule.component('vnSpinner', component);
|
||||
ngModule.vnComponent('vnSpinner', component);
|
||||
|
|
|
@ -6,7 +6,7 @@ describe('Component vnSpinner', () => {
|
|||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($compile, $rootScope) => {
|
||||
beforeEach(inject(($compile, $rootScope) => {
|
||||
$element = $compile(`<vn-spinner></vn-spinner>`)($rootScope);
|
||||
controller = $element.controller('vnSpinner');
|
||||
}));
|
||||
|
|
|
@ -74,7 +74,7 @@ export default class StepControl {
|
|||
|
||||
StepControl.$inject = ['$state'];
|
||||
|
||||
ngModule.component('vnStepControl', {
|
||||
ngModule.vnComponent('vnStepControl', {
|
||||
template: require('./step-control.html'),
|
||||
controller: StepControl,
|
||||
bindings: {
|
||||
|
|
|
@ -6,7 +6,7 @@ describe('Component vnStepControl', () => {
|
|||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$state_) => {
|
||||
beforeEach(inject(($componentController, _$state_) => {
|
||||
$state = _$state_;
|
||||
jest.spyOn($state, 'go');
|
||||
controller = $componentController('vnStepControl', {$state: $state});
|
||||
|
|
|
@ -45,7 +45,7 @@ export default class Table {
|
|||
|
||||
Table.$inject = ['$scope', '$element', '$transclude'];
|
||||
|
||||
ngModule.component('vnTable', {
|
||||
ngModule.vnComponent('vnTable', {
|
||||
template: require('./index.html'),
|
||||
transclude: true,
|
||||
controller: Table,
|
||||
|
|
|
@ -7,7 +7,7 @@ describe('Component vnTable', () => {
|
|||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
beforeEach(inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
$element = angular.element(`
|
||||
<vn-table model="model">
|
||||
|
|
|
@ -94,7 +94,7 @@ export default class Controller extends Component {
|
|||
}
|
||||
Controller.$inject = ['$element', '$scope', '$transclude', '$timeout'];
|
||||
|
||||
ngModule.component('vnTdEditable', {
|
||||
ngModule.vnComponent('vnTdEditable', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -6,7 +6,7 @@ describe('Component vnTextarea', () => {
|
|||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($compile, $rootScope) => {
|
||||
beforeEach(inject(($compile, $rootScope) => {
|
||||
$element = $compile(`<vn-textarea></vn-textarea>`)($rootScope);
|
||||
$ctrl = $element.controller('vnTextarea');
|
||||
}));
|
||||
|
|
|
@ -75,7 +75,7 @@ export default class Th {
|
|||
|
||||
Th.$inject = ['$element'];
|
||||
|
||||
ngModule.component('vnTh', {
|
||||
ngModule.vnComponent('vnTh', {
|
||||
template: require('./index.html'),
|
||||
transclude: true,
|
||||
controller: Th,
|
||||
|
|
|
@ -7,7 +7,7 @@ describe('Component vnTh', () => {
|
|||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject($componentController => {
|
||||
beforeEach(inject($componentController => {
|
||||
$element = angular.element(`<div>${template}</div>`);
|
||||
controller = $componentController('vnTh', {$element: $element});
|
||||
controller.table = {
|
||||
|
|
|
@ -197,7 +197,7 @@ export default class Tooltip extends Component {
|
|||
}
|
||||
Tooltip.$inject = ['$element', '$scope', '$timeout'];
|
||||
|
||||
ngModule.component('vnTooltip', {
|
||||
ngModule.vnComponent('vnTooltip', {
|
||||
template: require('./tooltip.html'),
|
||||
controller: Tooltip,
|
||||
transclude: true,
|
||||
|
|
|
@ -49,7 +49,7 @@ class Controller {
|
|||
}
|
||||
Controller.$inject = ['$element', '$scope', '$compile'];
|
||||
|
||||
ngModule.component('vnTreeviewChild', {
|
||||
ngModule.vnComponent('vnTreeviewChild', {
|
||||
template: require('./child.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -2,7 +2,7 @@ import ngModule from '../../module';
|
|||
|
||||
class Controller {}
|
||||
|
||||
ngModule.component('vnTreeviewChilds', {
|
||||
ngModule.vnComponent('vnTreeviewChilds', {
|
||||
template: require('./childs.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -247,7 +247,7 @@ export default class Treeview extends Component {
|
|||
|
||||
Treeview.$inject = ['$element', '$scope', '$transclude', '$window'];
|
||||
|
||||
ngModule.component('vnTreeview', {
|
||||
ngModule.vnComponent('vnTreeview', {
|
||||
template: require('./index.html'),
|
||||
controller: Treeview,
|
||||
bindings: {
|
||||
|
|
|
@ -267,7 +267,7 @@ export default class Watcher extends Component {
|
|||
}
|
||||
Watcher.$inject = ['$element', '$scope', '$state', '$stateParams', '$transitions', '$http', 'vnApp', '$translate', '$attrs', '$q'];
|
||||
|
||||
ngModule.component('vnWatcher', {
|
||||
ngModule.vnComponent('vnWatcher', {
|
||||
template: require('./watcher.html'),
|
||||
bindings: {
|
||||
url: '@?',
|
||||
|
|
|
@ -12,7 +12,7 @@ describe('Component vnWatcher', () => {
|
|||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$state_, _$q_) => {
|
||||
beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$state_, _$q_) => {
|
||||
$scope = $rootScope.$new();
|
||||
$element = angular.element('<div></div>');
|
||||
$state = _$state_;
|
||||
|
|
|
@ -7,7 +7,7 @@ describe('Directive zoomImage', () => {
|
|||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($compile, $rootScope) => {
|
||||
beforeEach(inject(($compile, $rootScope) => {
|
||||
compile = $compile;
|
||||
scope = $rootScope.$new();
|
||||
}));
|
||||
|
|
|
@ -5,7 +5,7 @@ describe('factory vnModuleLoader', () => {
|
|||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject((_vnModuleLoader_, _$rootScope_, $httpBackend, _$window_, $q) => {
|
||||
beforeEach(inject((_vnModuleLoader_, _$rootScope_, $httpBackend, _$window_, $q) => {
|
||||
vnModuleLoader = _vnModuleLoader_;
|
||||
$rootScope = _$rootScope_;
|
||||
$window = _$window_;
|
||||
|
|
|
@ -107,7 +107,7 @@ export class DescriptorContent {
|
|||
}
|
||||
DescriptorContent.$inject = ['$transclude', 'vnModules'];
|
||||
|
||||
ngModule.component('vnDescriptorContent', {
|
||||
ngModule.vnComponent('vnDescriptorContent', {
|
||||
template: require('./index.html'),
|
||||
controller: DescriptorContent,
|
||||
bindings: {
|
||||
|
|
|
@ -2,7 +2,7 @@ import ngModule from '../../module';
|
|||
|
||||
export default class QuickLink {}
|
||||
|
||||
ngModule.component('vnQuickLink', {
|
||||
ngModule.vnComponent('vnQuickLink', {
|
||||
template: require('./quick-link.html'),
|
||||
controller: QuickLink,
|
||||
bindings: {
|
||||
|
|
|
@ -28,7 +28,7 @@ export default class Controller extends Component {
|
|||
}
|
||||
Controller.$inject = ['$element', '$scope', 'vnModules', '$sce'];
|
||||
|
||||
ngModule.component('vnHome', {
|
||||
ngModule.vnComponent('vnHome', {
|
||||
template: require('./home.html'),
|
||||
controller: Controller
|
||||
});
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
import './index.js';
|
||||
|
||||
describe('Component vnMainMenu', () => {
|
||||
let $httpBackend;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('salix'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
|
||||
let vnModules = {get: () => {}};
|
||||
$httpBackend = _$httpBackend_;
|
||||
controller = $componentController('vnMainMenu', {vnModules});
|
||||
}));
|
||||
|
||||
describe('getCurrentUserName()', () => {
|
||||
it(`should set the user name property in the controller`, () => {
|
||||
$httpBackend.expect('GET', `Accounts/getUserData`).respond({name: 'batman'});
|
||||
controller.getCurrentUserName();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.$.$root.user.name).toEqual('batman');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -21,7 +21,7 @@ export class Layout extends Component {
|
|||
}
|
||||
Layout.$inject = ['$element', '$scope', 'vnModules'];
|
||||
|
||||
ngModule.component('vnLayout', {
|
||||
ngModule.vnComponent('vnLayout', {
|
||||
template: require('./index.html'),
|
||||
controller: Layout,
|
||||
require: {
|
||||
|
|
|
@ -6,7 +6,7 @@ describe('Component vnLayout', () => {
|
|||
|
||||
beforeEach(ngModule('salix'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
|
||||
beforeEach(inject(($componentController, _$httpBackend_) => {
|
||||
let vnModules = {get: () => {}};
|
||||
$httpBackend = _$httpBackend_;
|
||||
let $element = angular.element('<div></div>');
|
||||
|
|
|
@ -117,7 +117,7 @@ export default class LeftMenu {
|
|||
}
|
||||
LeftMenu.$inject = ['$state', '$transitions', 'aclService', '$timeout', '$element'];
|
||||
|
||||
ngModule.component('vnLeftMenu', {
|
||||
ngModule.vnComponent('vnLeftMenu', {
|
||||
template: require('./left-menu.html'),
|
||||
controller: LeftMenu,
|
||||
bindings: {
|
||||
|
|
|
@ -6,7 +6,7 @@ describe('Component vnLeftMenu', () => {
|
|||
|
||||
beforeEach(ngModule('salix'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $state, $window) => {
|
||||
beforeEach(inject(($componentController, $state, $window) => {
|
||||
$element = angular.element('<div></div>');
|
||||
$state.current.name = 'client.card.summary';
|
||||
$state.current.data = {moduleIndex: 0};
|
||||
|
|
|
@ -37,7 +37,7 @@ export default class Controller {
|
|||
}
|
||||
Controller.$inject = ['$scope', '$element', 'vnAuth'];
|
||||
|
||||
ngModule.component('vnLogin', {
|
||||
ngModule.vnComponent('vnLogin', {
|
||||
template: require('./login.html'),
|
||||
controller: Controller
|
||||
});
|
||||
|
|
|
@ -68,7 +68,7 @@ export default class SideMenu extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnSideMenu', {
|
||||
ngModule.vnComponent('vnSideMenu', {
|
||||
template: require('./side-menu.html'),
|
||||
controller: SideMenu,
|
||||
transclude: true,
|
||||
|
|
|
@ -80,7 +80,7 @@ class Controller {
|
|||
}
|
||||
Controller.$inject = ['$scope', '$translate', 'vnConfig', 'vnAuth'];
|
||||
|
||||
ngModule.component('vnUserPopover', {
|
||||
ngModule.vnComponent('vnUserPopover', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ describe('Salix', () => {
|
|||
|
||||
beforeEach(ngModule('salix'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, $httpBackend) => {
|
||||
beforeEach(inject(($componentController, $rootScope, $httpBackend) => {
|
||||
$httpBackend.expectGET('UserConfigs/getUserConfig');
|
||||
|
||||
$scope = $rootScope.$new();
|
||||
|
|
|
@ -154,7 +154,7 @@ export default class Controller extends Section {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnClaimAction', {
|
||||
ngModule.vnComponent('vnClaimAction', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -9,7 +9,7 @@ describe('claim', () => {
|
|||
|
||||
beforeEach(ngModule('claim'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_) => {
|
||||
beforeEach(inject(($componentController, _$state_, _$httpBackend_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
$state = _$state_;
|
||||
$state.params.id = 1;
|
||||
|
@ -91,7 +91,7 @@ describe('claim', () => {
|
|||
$httpBackend.flush();
|
||||
|
||||
expect(controller.$.model.refresh).toHaveBeenCalledWith();
|
||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
||||
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||
expect(controller.$.lastTicketsPopover.hide).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
@ -106,7 +106,7 @@ describe('claim', () => {
|
|||
$httpBackend.flush();
|
||||
|
||||
expect(controller.card.reload).toHaveBeenCalledWith();
|
||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
||||
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class Controller extends Section {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnClaimBasicData', {
|
||||
ngModule.vnComponent('vnClaimBasicData', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('Claim', () => {
|
|||
|
||||
beforeEach(ngModule('claim'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
beforeEach(inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
$scope.watcher = watcher;
|
||||
const $element = angular.element('<vn-claim-basic-data></vn-claim-basic-data>');
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('Claim', () => {
|
|||
|
||||
beforeEach(ngModule('claim'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $stateParams) => {
|
||||
beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
|
||||
let $element = angular.element('<div></div>');
|
||||
|
|
|
@ -75,7 +75,7 @@ class Controller extends Section {
|
|||
this.$http.post(query, saleToAdd).then(() => {
|
||||
this.$.addSales.hide();
|
||||
this.$.model.refresh();
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
|
||||
if (this.aclService.hasAny(['salesAssistant']))
|
||||
this.$state.go('claim.card.development');
|
||||
|
@ -90,7 +90,7 @@ class Controller extends Section {
|
|||
deleteClaimedSale() {
|
||||
let query = `ClaimBeginnings/${this.sale.id}`;
|
||||
this.$http.delete(query).then(() => {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
this.$.model.remove(this.sale);
|
||||
this.calculateTotals();
|
||||
});
|
||||
|
@ -100,7 +100,7 @@ class Controller extends Section {
|
|||
let params = {id: id, quantity: claimedQuantity};
|
||||
let query = `ClaimBeginnings/`;
|
||||
this.$http.patch(query, params).then(() => {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
this.calculateTotals();
|
||||
});
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ class Controller extends Section {
|
|||
showEditPopover(event, saleClaimed) {
|
||||
if (this.isEditable) {
|
||||
if (!this.aclService.hasAny(['salesAssistant']))
|
||||
return this.vnApp.showError(this.$translate.instant('Insuficient permisos'));
|
||||
return this.vnApp.showError(this.$t('Insuficient permisos'));
|
||||
|
||||
this.saleClaimed = saleClaimed;
|
||||
this.$.editPopover.parent = event.target;
|
||||
|
@ -175,7 +175,7 @@ class Controller extends Section {
|
|||
this.calculateTotals();
|
||||
this.clearDiscount();
|
||||
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
}).catch(err => {
|
||||
this.vnApp.showError(err.message);
|
||||
});
|
||||
|
@ -196,7 +196,7 @@ class Controller extends Section {
|
|||
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
|
||||
ngModule.component('vnClaimDetail', {
|
||||
ngModule.vnComponent('vnClaimDetail', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -9,7 +9,7 @@ describe('claim', () => {
|
|||
|
||||
beforeEach(ngModule('claim'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => {
|
||||
beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
$scope.descriptor = {
|
||||
show: () => {}
|
||||
|
@ -80,7 +80,7 @@ describe('claim', () => {
|
|||
controller.deleteClaimedSale();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
||||
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -91,7 +91,7 @@ describe('claim', () => {
|
|||
controller.setClaimedQuantity(1, 1);
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
||||
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -126,7 +126,7 @@ describe('claim', () => {
|
|||
|
||||
expect(controller.calculateTotals).toHaveBeenCalledWith();
|
||||
expect(controller.clearDiscount).toHaveBeenCalledWith();
|
||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
||||
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||
expect(controller.$.editPopover.hide).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ class Controller extends Section {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnClaimDevelopment', {
|
||||
ngModule.vnComponent('vnClaimDevelopment', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -9,7 +9,7 @@ describe('Claim', () => {
|
|||
|
||||
beforeEach(ngModule('claim'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
beforeEach(inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
$scope.watcher = watcher;
|
||||
$scope.model = crudModel;
|
||||
|
|
|
@ -19,7 +19,7 @@ export default class Controller extends Section {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnClaimIndex', {
|
||||
ngModule.vnComponent('vnClaimIndex', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
||||
|
|
|
@ -93,7 +93,7 @@ class Controller extends Section {
|
|||
|
||||
Controller.$inject = ['$element', '$scope', 'vnFile'];
|
||||
|
||||
ngModule.component('vnClaimPhotos', {
|
||||
ngModule.vnComponent('vnClaimPhotos', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -9,7 +9,7 @@ describe('Claim', () => {
|
|||
|
||||
beforeEach(ngModule('claim'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
||||
beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
$scope = $rootScope.$new();
|
||||
controller = $componentController('vnClaimPhotos', {$element: null, $scope});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import ngModule from '../module';
|
||||
import SearchPanel from 'core/components/searchbar/search-panel';
|
||||
|
||||
ngModule.component('vnClaimSearchPanel', {
|
||||
ngModule.vnComponent('vnClaimSearchPanel', {
|
||||
template: require('./index.html'),
|
||||
controller: SearchPanel
|
||||
});
|
||||
|
|
|
@ -45,7 +45,7 @@ class Controller extends Section {
|
|||
|
||||
Controller.$inject = ['$element', '$scope', 'vnFile'];
|
||||
|
||||
ngModule.component('vnClaimSummary', {
|
||||
ngModule.vnComponent('vnClaimSummary', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -9,7 +9,7 @@ describe('Claim', () => {
|
|||
|
||||
beforeEach(ngModule('claim'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => {
|
||||
beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
$httpBackend = _$httpBackend_;
|
||||
const $element = angular.element('<vn-claim-summary></vn-claim-summary>');
|
||||
|
@ -20,8 +20,7 @@ describe('Claim', () => {
|
|||
|
||||
describe('getSummary()', () => {
|
||||
it('should perform a query to set summary', () => {
|
||||
$httpBackend.when('GET', `Claims/1/getSummary`).respond(200, 24);
|
||||
$httpBackend.expect('GET', `Claims/1/getSummary`);
|
||||
$httpBackend.expect('GET', `Claims/1/getSummary`).respond(200, 24);
|
||||
controller.getSummary();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ export default class Controller extends Section {
|
|||
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
|
||||
ngModule.component('vnClientAddressCreate', {
|
||||
ngModule.vnComponent('vnClientAddressCreate', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -11,7 +11,7 @@ describe('Client', () => {
|
|||
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_, _$httpBackend_) => {
|
||||
beforeEach(inject(($componentController, $rootScope, _$state_, _$httpBackend_) => {
|
||||
$scope = $rootScope.$new();
|
||||
$httpBackend = _$httpBackend_;
|
||||
$state = _$state_;
|
||||
|
|
|
@ -81,7 +81,7 @@ export default class Controller extends Section {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnClientAddressEdit', {
|
||||
ngModule.vnComponent('vnClientAddressEdit', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
require: {
|
||||
|
|
|
@ -10,7 +10,7 @@ describe('Client', () => {
|
|||
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_, _$httpBackend_) => {
|
||||
beforeEach(inject(($componentController, $rootScope, _$state_, _$httpBackend_) => {
|
||||
$scope = $rootScope.$new();
|
||||
$httpBackend = _$httpBackend_;
|
||||
$state = _$state_;
|
||||
|
|
|
@ -50,7 +50,7 @@ class Controller extends Section {
|
|||
if (res.data) {
|
||||
this.client.defaultAddressFk = res.data.defaultAddressFk;
|
||||
this.sortAddresses();
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ class Controller extends Section {
|
|||
}
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
|
||||
ngModule.component('vnClientAddressIndex', {
|
||||
ngModule.vnComponent('vnClientAddressIndex', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -10,7 +10,7 @@ describe('Client', () => {
|
|||
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$stateParams_, _$httpBackend_) => {
|
||||
beforeEach(inject(($componentController, $rootScope, _$stateParams_, _$httpBackend_) => {
|
||||
$stateParams = _$stateParams_;
|
||||
$stateParams.id = 1;
|
||||
$httpBackend = _$httpBackend_;
|
||||
|
@ -28,8 +28,7 @@ describe('Client', () => {
|
|||
let data = {defaultAddressFk: address.id};
|
||||
let expectedResult = {defaultAddressFk: address.id};
|
||||
|
||||
$httpBackend.when('PATCH', `Clients/1`, data).respond(200, expectedResult);
|
||||
$httpBackend.expect('PATCH', `Clients/1`, data);
|
||||
$httpBackend.expect('PATCH', `Clients/1`, data).respond(200, expectedResult);
|
||||
controller.setDefault(address);
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ class Controller extends Section {
|
|||
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
|
||||
ngModule.component('vnClientBalanceIndex', {
|
||||
ngModule.vnComponent('vnClientBalanceIndex', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@ describe('Client', () => {
|
|||
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
beforeEach(inject(($componentController, $rootScope) => {
|
||||
let $scope = $rootScope.$new();
|
||||
const $element = angular.element('<vn-client-balance-index></vn-client-balance-index>');
|
||||
controller = $componentController('vnClientBalanceIndex', {$element, $scope});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
ngModule.component('vnClientBasicData', {
|
||||
ngModule.vnComponent('vnClientBasicData', {
|
||||
template: require('./index.html'),
|
||||
controller: Section,
|
||||
bindings: {
|
||||
|
|
|
@ -77,7 +77,7 @@ export default class Controller extends Section {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnClientBillingData', {
|
||||
ngModule.vnComponent('vnClientBillingData', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -9,7 +9,7 @@ describe('Client', () => {
|
|||
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => {
|
||||
beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => {
|
||||
let $element = angular.element('<vn-client-billing-data></vn-client-billing-data>');
|
||||
$httpBackend = _$httpBackend_;
|
||||
vnApp = _vnApp_;
|
||||
|
|
|
@ -8,7 +8,7 @@ export default class Controller extends ModuleCard {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnClientCard', {
|
||||
ngModule.vnComponent('vnClientCard', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('Client', () => {
|
|||
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $stateParams) => {
|
||||
beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
|
||||
let $element = angular.element('<div></div>');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import ngModule from '../module';
|
||||
import SearchPanel from 'core/components/searchbar/search-panel';
|
||||
|
||||
ngModule.component('vnConsumptionSearchPanel', {
|
||||
ngModule.vnComponent('vnConsumptionSearchPanel', {
|
||||
template: require('./index.html'),
|
||||
controller: SearchPanel
|
||||
});
|
||||
|
|
|
@ -57,7 +57,7 @@ class Controller extends Section {
|
|||
|
||||
Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail'];
|
||||
|
||||
ngModule.component('vnClientConsumption', {
|
||||
ngModule.vnComponent('vnClientConsumption', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -10,7 +10,7 @@ describe('Client', () => {
|
|||
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpParamSerializer_, _$httpBackend_) => {
|
||||
beforeEach(inject(($componentController, $rootScope, _$httpParamSerializer_, _$httpBackend_) => {
|
||||
$scope = $rootScope.$new();
|
||||
$httpParamSerializer = _$httpParamSerializer_;
|
||||
$httpBackend = _$httpBackend_;
|
||||
|
|
|
@ -5,7 +5,7 @@ class Controller extends Section {
|
|||
add() {
|
||||
this.$.model.insert({
|
||||
clientFk: this.client.id,
|
||||
name: this.$translate.instant('Phone'),
|
||||
name: this.$t('Phone'),
|
||||
phone: null
|
||||
});
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class Controller extends Section {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnClientContact', {
|
||||
ngModule.vnComponent('vnClientContact', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -86,7 +86,7 @@ export default class Controller extends Section {
|
|||
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
|
||||
ngModule.component('vnClientCreate', {
|
||||
ngModule.vnComponent('vnClientCreate', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('Client', () => {
|
|||
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => {
|
||||
beforeEach(inject(($componentController, $rootScope, _$state_) => {
|
||||
$scope = $rootScope.$new();
|
||||
$state = _$state_;
|
||||
$scope.watcher = {
|
||||
|
|
|
@ -11,7 +11,7 @@ class Controller extends Section {
|
|||
|
||||
onSubmit() {
|
||||
if (this.$.form.$invalid)
|
||||
return this.vnApp.showError(this.$translate.instant('Some fields are invalid'));
|
||||
return this.vnApp.showError(this.$t('Some fields are invalid'));
|
||||
|
||||
let query = `creditClassifications/createWithInsurance`;
|
||||
let data = this.creditClassification;
|
||||
|
@ -28,7 +28,7 @@ class Controller extends Section {
|
|||
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
|
||||
ngModule.component('vnClientCreditInsuranceCreate', {
|
||||
ngModule.vnComponent('vnClientCreditInsuranceCreate', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
require: {
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('Client', () => {
|
|||
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
||||
beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
$scope = $rootScope.$new();
|
||||
$scope.form = {
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
</vn-float-button>
|
||||
<vn-confirm
|
||||
vn-id="close-contract"
|
||||
on-response="$ctrl.returnDialog($response)"
|
||||
on-accept="$ctrl.returnDialog()"
|
||||
question="Close contract"
|
||||
message="Are you sure you want to close this contract?">
|
||||
</vn-confirm>
|
|
@ -51,17 +51,15 @@ class Controller extends Section {
|
|||
this.$.closeContract.show();
|
||||
}
|
||||
|
||||
returnDialog(response) {
|
||||
if (response === 'accept') {
|
||||
let params = {finished: Date.now()};
|
||||
this.$http.patch(`CreditClassifications/${this.classificationId}`, params).then(() => {
|
||||
this._getClassifications(this.client.id);
|
||||
});
|
||||
}
|
||||
returnDialog() {
|
||||
let params = {finished: Date.now()};
|
||||
this.$http.patch(`CreditClassifications/${this.classificationId}`, params).then(() => {
|
||||
this._getClassifications(this.client.id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnClientCreditInsuranceIndex', {
|
||||
ngModule.vnComponent('vnClientCreditInsuranceIndex', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('Client', () => {
|
|||
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => {
|
||||
beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
$scope = $rootScope.$new();
|
||||
const $element = angular.element('<vn-client-credit-insurance-index></vn-client-credit-insurance-index>');
|
||||
|
@ -77,9 +77,8 @@ describe('Client', () => {
|
|||
it('should call the returnDialog method and perform a PATCH query, then call _getClassifications method', () => {
|
||||
jest.spyOn(controller, '_getClassifications').mockReturnThis();
|
||||
controller.classificationId = 1;
|
||||
$httpBackend.when('PATCH', `CreditClassifications/1`).respond(200);
|
||||
$httpBackend.expect('PATCH', `CreditClassifications/1`);
|
||||
controller.returnDialog('accept');
|
||||
$httpBackend.expect('PATCH', `CreditClassifications/1`).respond(200);
|
||||
controller.returnDialog();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller._getClassifications).toHaveBeenCalledWith(101);
|
||||
|
|
|
@ -21,7 +21,7 @@ class Controller extends Section {
|
|||
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
|
||||
ngModule.component('vnClientCreditInsuranceInsuranceCreate', {
|
||||
ngModule.vnComponent('vnClientCreditInsuranceInsuranceCreate', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
require: {
|
||||
|
|
|
@ -29,7 +29,7 @@ class Controller extends Section {
|
|||
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
|
||||
ngModule.component('vnClientCreditInsuranceInsuranceIndex', {
|
||||
ngModule.vnComponent('vnClientCreditInsuranceInsuranceIndex', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('Client', () => {
|
|||
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => {
|
||||
beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
$httpBackend = _$httpBackend_;
|
||||
const $element = angular.element('<vn-client-credit-insurance-insurance-index></vn-client-credit-insurance-insurance-index>');
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
</form>
|
||||
<vn-confirm
|
||||
vn-id="confirmation"
|
||||
on-response="$ctrl.returnDialog($response)"
|
||||
on-accept="$ctrl.returnDialog()"
|
||||
question="Esta modificación retrasará el plazo del próximo recobro"
|
||||
message="¿Desea continuar?">
|
||||
</vn-confirm>
|
||||
|
|
|
@ -16,9 +16,8 @@ class Controller extends Section {
|
|||
this.goToIndex();
|
||||
}
|
||||
|
||||
returnDialog(response) {
|
||||
if (response === 'accept')
|
||||
this.addCredit();
|
||||
returnDialog() {
|
||||
this.addCredit();
|
||||
}
|
||||
|
||||
goToIndex() {
|
||||
|
@ -34,7 +33,7 @@ class Controller extends Section {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnClientCreditCreate', {
|
||||
ngModule.vnComponent('vnClientCreditCreate', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -10,7 +10,7 @@ describe('Client', () => {
|
|||
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope, _$state_) => {
|
||||
beforeEach(inject(($componentController, _$httpBackend_, $rootScope, _$state_) => {
|
||||
$scope = $rootScope.$new();
|
||||
$scope.confirmation = {show: () => {
|
||||
return {
|
||||
|
@ -75,7 +75,7 @@ describe('Client', () => {
|
|||
describe('returnDialog()', () => {
|
||||
it('should call addCredit() when is called with accept', () => {
|
||||
jest.spyOn(controller, 'addCredit');
|
||||
controller.returnDialog('accept');
|
||||
controller.returnDialog();
|
||||
|
||||
expect(controller.addCredit).toHaveBeenCalledWith();
|
||||
});
|
||||
|
|
|
@ -25,7 +25,7 @@ class Controller extends Section {
|
|||
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
|
||||
ngModule.component('vnClientCreditIndex', {
|
||||
ngModule.vnComponent('vnClientCreditIndex', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
||||
|
|
|
@ -33,7 +33,7 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
get contentTypesInfo() {
|
||||
return this.$translate.instant('ContentTypesInfo', {
|
||||
return this.$t('ContentTypesInfo', {
|
||||
allowedContentTypes: this.allowedContentTypes
|
||||
});
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class Controller extends Section {
|
|||
warehouseId: warehouseId,
|
||||
companyId: companyId,
|
||||
dmsTypeId: dmsType.id,
|
||||
description: this.$translate.instant('ClientFileDescription', {
|
||||
description: this.$t('ClientFileDescription', {
|
||||
dmsTypeName: dmsType.name,
|
||||
clientId: this.client.id,
|
||||
clientName: this.client.name
|
||||
|
@ -83,7 +83,7 @@ class Controller extends Section {
|
|||
};
|
||||
this.$http(options).then(res => {
|
||||
if (res) {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
this.$.watcher.updateOriginalData();
|
||||
this.$state.go('client.card.dms.index');
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class Controller extends Section {
|
|||
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
|
||||
ngModule.component('vnClientDmsCreate', {
|
||||
ngModule.vnComponent('vnClientDmsCreate', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
|
@ -9,7 +9,7 @@ describe('Client', () => {
|
|||
|
||||
beforeEach(ngModule('client'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
|
||||
beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
|
||||
$scope = $rootScope.$new();
|
||||
$httpBackend = _$httpBackend_;
|
||||
$httpParamSerializer = _$httpParamSerializer_;
|
||||
|
@ -39,8 +39,7 @@ describe('Client', () => {
|
|||
where: {code: 'paymentsLaw'}
|
||||
}};
|
||||
let serializedParams = $httpParamSerializer(params);
|
||||
$httpBackend.when('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 12, code: 'paymentsLaw'});
|
||||
$httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`);
|
||||
$httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 12, code: 'paymentsLaw'});
|
||||
controller.setDefaultParams();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
@ -63,8 +62,7 @@ describe('Client', () => {
|
|||
describe('getAllowedContentTypes()', () => {
|
||||
it('should make an HTTP GET request to get the allowed content types', () => {
|
||||
const expectedResponse = ['image/png', 'image/jpg'];
|
||||
$httpBackend.when('GET', `clientDms/allowedContentTypes`).respond(expectedResponse);
|
||||
$httpBackend.expect('GET', `clientDms/allowedContentTypes`);
|
||||
$httpBackend.expect('GET', `clientDms/allowedContentTypes`).respond(expectedResponse);
|
||||
controller.getAllowedContentTypes();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
get contentTypesInfo() {
|
||||
return this.$translate.instant('ContentTypesInfo', {
|
||||
return this.$t('ContentTypesInfo', {
|
||||
allowedContentTypes: this.allowedContentTypes
|
||||
});
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ class Controller extends Section {
|
|||
};
|
||||
this.$http(options).then(res => {
|
||||
if (res) {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
this.$.watcher.updateOriginalData();
|
||||
this.$state.go('client.card.dms.index');
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ class Controller extends Section {
|
|||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnClientDmsEdit', {
|
||||
ngModule.vnComponent('vnClientDmsEdit', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue