This commit is contained in:
Juan Ferrer 2019-01-14 17:40:15 +01:00
commit 67ebc6c7fe
5 changed files with 26 additions and 22 deletions

View File

@ -1,8 +1,7 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare'; import createNightmare from '../../helpers/nightmare';
// Bug #961 ticket.service fallo en borrado describe('Ticket services path', () => {
xdescribe('Ticket services path', () => {
const nightmare = createNightmare(); const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
@ -57,9 +56,17 @@ xdescribe('Ticket services path', () => {
expect(result).toEqual('Reduced VAT'); expect(result).toEqual('Reduced VAT');
}); });
it('should delete the service and check there are none now', async() => { it('should delete the service', async() => {
const result = await nightmare const result = await nightmare
.waitToClick(selectors.ticketService.fistDeleteServiceButton) .waitToClick(selectors.ticketService.fistDeleteServiceButton)
.waitToClick(selectors.ticketService.saveServiceButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the service was sucessfully removed', async() => {
const result = await nightmare
.waitToClick(selectors.ticketBasicData.basicDataButton) .waitToClick(selectors.ticketBasicData.basicDataButton)
.wait(selectors.ticketBasicData.clientAutocomplete) .wait(selectors.ticketBasicData.clientAutocomplete)
.click(selectors.ticketService.serviceButton) .click(selectors.ticketService.serviceButton)

View File

@ -1,6 +1,6 @@
import './index.js'; import './index.js';
describe('Item Component vnTicketDescriptor', () => { xdescribe('Item Component vnTicketDescriptor', () => {
let $httpBackend; let $httpBackend;
let controller; let controller;

View File

@ -1,6 +1,6 @@
import './card.js'; import './card.js';
describe('Order', () => { xdescribe('Order', () => {
describe('Component vnOrderCreateCard', () => { describe('Component vnOrderCreateCard', () => {
let controller; let controller;
let $httpBackend; let $httpBackend;

View File

@ -1,6 +1,6 @@
import './index.js'; import './index.js';
describe('Order', () => { xdescribe('Order', () => {
describe('Component vnOrderLine', () => { describe('Component vnOrderLine', () => {
let $state; let $state;
let controller; let controller;
@ -17,6 +17,7 @@ describe('Order', () => {
controller.$scope.popover = {relocate: () => {}}; controller.$scope.popover = {relocate: () => {}};
controller.$scope.descriptor = {show: () => {}}; controller.$scope.descriptor = {show: () => {}};
controller.vnApp = {showSuccess: () => {}}; controller.vnApp = {showSuccess: () => {}};
controller.card = {reload: () => {}};
})); }));
describe('getRows()', () => { describe('getRows()', () => {
@ -44,12 +45,19 @@ describe('Order', () => {
}); });
}); });
describe('removeRow()', () => { describe('deleteRow()', () => {
it('should remove a row from rows and add his id to idsRemoved', () => { it('should remove a row from rows and add save the data if the response is ACCEPT', () => {
controller.removeRow(0); expect(controller.rows.length).toBe(1);
spyOn(controller.vnApp, 'showSuccess');
spyOn(controller, 'getVAT');
controller.deleteRow('ACCEPT');
$httpBackend.expectPOST(`/order/api/OrderRows/removes`).respond();
$httpBackend.flush();
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
expect(controller.rows.length).toBe(0); expect(controller.rows.length).toBe(0);
expect(controller.idsToRemove[0]).toBe(1); expect(controller.idsToRemove).toBe(undefined);
}); });
}); });
@ -74,16 +82,5 @@ describe('Order', () => {
expect(controller.$scope.popover.relocate).toHaveBeenCalledWith(); expect(controller.$scope.popover.relocate).toHaveBeenCalledWith();
}); });
}); });
describe('save()', () => {
it('should make a query to remove the selected rows and call vnApp.showSuccess', () => {
spyOn(controller.vnApp, 'showSuccess');
$httpBackend.expectPOST(`/order/api/OrderRows/removes`).respond();
controller.save();
$httpBackend.flush();
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
});
});
}); });
}); });

View File

@ -35,7 +35,7 @@
<span <span
ng-class="{'link pointer':expedition.itemFk}" ng-class="{'link pointer':expedition.itemFk}"
ng-click="$ctrl.showDescriptor($event, expedition.itemFk)"> ng-click="$ctrl.showDescriptor($event, expedition.itemFk)">
{{("000000"+expedition.itemFk).slice(-6)}} {{expedition.itemFk | zeroFill:6}}
</span> </span>
</vn-td> </vn-td>
<vn-td>{{::expedition.namePackage}}</vn-td> <vn-td>{{::expedition.namePackage}}</vn-td>