Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good
Details
gitea/salix/dev This commit looks good
Details
This commit is contained in:
commit
68aaade0a9
|
@ -466,7 +466,18 @@ export default {
|
||||||
secondClaimResponsibleAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.claimResponsibleFk"]',
|
secondClaimResponsibleAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.claimResponsibleFk"]',
|
||||||
secondClaimWorkerAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.workerFk"]',
|
secondClaimWorkerAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.workerFk"]',
|
||||||
secondClaimRedeliveryAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.claimRedeliveryFk"]',
|
secondClaimRedeliveryAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.claimRedeliveryFk"]',
|
||||||
saveDevelopmentButton: `${components.vnSubmit}`
|
saveDevelopmentButton: `${components.vnSubmit}`,
|
||||||
|
},
|
||||||
|
claimAction: {
|
||||||
|
importClaimButton: 'vn-claim-action vn-button[label="Import claim"]',
|
||||||
|
importTicketButton: 'vn-claim-action vn-button[label="Import ticket"]',
|
||||||
|
secondImportableTicket: 'vn-claim-action > vn-vertical > vn-popover > div > div.content > div > vn-table > div > vn-tbody > vn-tr:nth-child(2)',
|
||||||
|
firstLineDestination: 'vn-claim-action vn-tr:nth-child(1) vn-autocomplete[field="saleClaimed.claimDestinationFk"]',
|
||||||
|
thirdLineDestination: 'vn-claim-action vn-tr:nth-child(3) vn-autocomplete[field="saleClaimed.claimDestinationFk"]',
|
||||||
|
firstDeleteLine: 'vn-claim-action vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
|
||||||
|
secondDeleteLine: 'vn-claim-action vn-tr:nth-child(2) vn-icon-button[icon="delete"]',
|
||||||
|
thirdDeleteLine: 'vn-claim-action vn-tr:nth-child(3) vn-icon-button[icon="delete"]'
|
||||||
|
|
||||||
},
|
},
|
||||||
ordersIndex: {
|
ordersIndex: {
|
||||||
searchResult: `vn-order-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr`,
|
searchResult: `vn-order-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr`,
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
import selectors from '../../helpers/selectors.js';
|
||||||
|
import createNightmare from '../../helpers/nightmare';
|
||||||
|
|
||||||
|
describe('Claim edit basic data path', () => {
|
||||||
|
const nightmare = createNightmare();
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
nightmare
|
||||||
|
.loginAndModule('administrative', 'claim')
|
||||||
|
.accessToSearchResult('4')
|
||||||
|
.accessToSection('claim.card.action');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should import the claim', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.waitToClick(selectors.claimAction.importClaimButton)
|
||||||
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should import the eighth ticket', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.waitToClick(selectors.claimAction.importTicketButton)
|
||||||
|
.waitToClick(selectors.claimAction.secondImportableTicket)
|
||||||
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should edit the fourth line destination field', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.autocompleteSearch(selectors.claimAction.thirdLineDestination, 'Bueno')
|
||||||
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should delete two first lines', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.waitToClick(selectors.claimAction.secondDeleteLine)
|
||||||
|
.waitToClick(selectors.claimAction.firstDeleteLine)
|
||||||
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should refresh the view to check the remaining line is the expected one', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.reloadSection('claim.card.action')
|
||||||
|
.waitToGetProperty(`${selectors.claimAction.firstLineDestination} input`, 'value');
|
||||||
|
|
||||||
|
expect(result).toEqual('Bueno');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should delete the current first line', async() => {
|
||||||
|
const result = await nightmare
|
||||||
|
.waitToClick(selectors.claimAction.firstDeleteLine)
|
||||||
|
.waitForLastSnackbar();
|
||||||
|
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,84 @@
|
||||||
|
import './searchbar.js';
|
||||||
|
|
||||||
|
describe('Component vnSearchbar', () => {
|
||||||
|
let controller;
|
||||||
|
let $element;
|
||||||
|
let $state;
|
||||||
|
|
||||||
|
beforeEach(ngModule('vnCore'));
|
||||||
|
|
||||||
|
beforeEach(angular.mock.inject(($componentController, _$state_) => {
|
||||||
|
$state = _$state_;
|
||||||
|
$element = angular.element(`<div></div>`);
|
||||||
|
controller = $componentController('vnSearchbar', {$element, $state});
|
||||||
|
controller.panel = 'vn-client-search-panel';
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('$postLink()', () => {
|
||||||
|
it(`should not call onStateChange() if filter is defined`, () => {
|
||||||
|
spyOn(controller, 'onStateChange');
|
||||||
|
controller.filter = {};
|
||||||
|
|
||||||
|
controller.$postLink();
|
||||||
|
|
||||||
|
expect(controller.onStateChange).not.toHaveBeenCalledWith();
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should call onStateChange() if filter is null`, () => {
|
||||||
|
spyOn(controller, 'onStateChange');
|
||||||
|
controller.filter = null;
|
||||||
|
|
||||||
|
controller.$postLink();
|
||||||
|
|
||||||
|
expect(controller.onStateChange).toHaveBeenCalledWith();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('filter() setter', () => {
|
||||||
|
it(`should call $state.go()`, () => {
|
||||||
|
controller._filter = {};
|
||||||
|
spyOn(controller.$state, 'go');
|
||||||
|
controller.filter = {expected: 'filter'};
|
||||||
|
|
||||||
|
expect(controller._filter).toEqual(controller.filter);
|
||||||
|
expect(controller.$state.go).toHaveBeenCalledWith('.', Object({q: '{"expected":"filter"}'}));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('openPanel()', () => {
|
||||||
|
it(`should do nothing if the event is prevented`, () => {
|
||||||
|
let event = {
|
||||||
|
defaultPrevented: true,
|
||||||
|
preventDefault: jasmine.createSpy('preventDefault')
|
||||||
|
};
|
||||||
|
controller.openPanel(event);
|
||||||
|
|
||||||
|
expect(event.preventDefault).not.toHaveBeenCalledWith();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getObjectFromString()', () => {
|
||||||
|
it(`should return a formated object based on the string received for basic search`, () => {
|
||||||
|
let result = controller.getObjectFromString('Bruce Wayne');
|
||||||
|
|
||||||
|
expect(result).toEqual({search: 'Bruce Wayne'});
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should return a formated object based on the string received for advanced search`, () => {
|
||||||
|
let result = controller.getObjectFromString('id:101 name:(Bruce Wayne)');
|
||||||
|
|
||||||
|
expect(result).toEqual({id: '101', name: 'Bruce Wayne'});
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should format the object grouping any unmatched part of the instring of the string to the search property`, () => {
|
||||||
|
let string = 'I am the search id:101 name:(Bruce Wayne) concatenated value';
|
||||||
|
let result = controller.getObjectFromString(string);
|
||||||
|
|
||||||
|
expect(result).toEqual({
|
||||||
|
id: '101',
|
||||||
|
name: 'Bruce Wayne',
|
||||||
|
search: 'I am the search concatenated value'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue