#1285 fixed, vnInputTime fixes
This commit is contained in:
parent
907b4a4991
commit
2bcdcaa133
|
@ -75,7 +75,7 @@ let actions = {
|
|||
},
|
||||
|
||||
changeLanguageToEnglish: function(done) {
|
||||
let langSelector = 'vn-user-configuration-popover vn-autocomplete[field="$ctrl.lang"]';
|
||||
let langSelector = '.user-configuration vn-autocomplete[field="$ctrl.lang"]';
|
||||
|
||||
this.waitToClick('#user')
|
||||
.wait(langSelector)
|
||||
|
@ -180,6 +180,7 @@ let actions = {
|
|||
.evaluate_now(elementSelector => {
|
||||
const selectorMatches = document.querySelectorAll(elementSelector);
|
||||
const element = selectorMatches[0];
|
||||
|
||||
if (selectorMatches.length > 1)
|
||||
throw new Error(`multiple matches of ${elementSelector} found`);
|
||||
|
||||
|
@ -190,17 +191,18 @@ let actions = {
|
|||
isVisible = true;
|
||||
};
|
||||
element.addEventListener('mouseover', eventHandler);
|
||||
const elementBoundaries = element.getBoundingClientRect();
|
||||
const x = elementBoundaries.left + element.offsetWidth / 2;
|
||||
const y = elementBoundaries.top + element.offsetHeight / 2;
|
||||
const rect = element.getBoundingClientRect();
|
||||
const x = rect.left + rect.width / 2;
|
||||
const y = rect.top + rect.height / 2;
|
||||
const elementInCenter = document.elementFromPoint(x, y);
|
||||
const elementInTopLeft = document.elementFromPoint(elementBoundaries.left, elementBoundaries.top);
|
||||
const elementInBottomRight = document.elementFromPoint(elementBoundaries.right, elementBoundaries.bottom);
|
||||
const elementInTopLeft = document.elementFromPoint(rect.left, rect.top);
|
||||
const elementInBottomRight = document.elementFromPoint(rect.right, rect.bottom);
|
||||
const e = new MouseEvent('mouseover', {
|
||||
view: window,
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
});
|
||||
|
||||
if (elementInCenter)
|
||||
elementInCenter.dispatchEvent(e);
|
||||
|
||||
|
@ -401,10 +403,12 @@ let actions = {
|
|||
autocompleteSearch: function(autocompleteSelector, searchValue, done) {
|
||||
this.wait(`${autocompleteSelector} input`)
|
||||
.waitToClick(`${autocompleteSelector} input`)
|
||||
.write(`${autocompleteSelector} vn-drop-down input`, searchValue)
|
||||
.waitToClick(`${autocompleteSelector} li.active`)
|
||||
.write(`.vn-popover.shown .vn-drop-down input`, searchValue)
|
||||
.waitToClick(`.vn-popover.shown .vn-drop-down li.active`)
|
||||
.wait((autocompleteSelector, searchValue) => {
|
||||
return document.querySelector(`${autocompleteSelector} input`).value.toLowerCase().includes(searchValue.toLowerCase());
|
||||
return document.querySelector(`${autocompleteSelector} input`).value
|
||||
.toLowerCase()
|
||||
.includes(searchValue.toLowerCase());
|
||||
}, autocompleteSelector, searchValue)
|
||||
.then(done)
|
||||
.catch(() => {
|
||||
|
@ -412,6 +416,17 @@ let actions = {
|
|||
});
|
||||
},
|
||||
|
||||
pickTime: function(selector, time, done) {
|
||||
this.wait(selector)
|
||||
.evaluate((selector, time) => {
|
||||
let input = document.querySelector(selector);
|
||||
input.value = time;
|
||||
input.dispatchEvent(new Event('change'));
|
||||
}, selector, time)
|
||||
.then(done)
|
||||
.catch(done);
|
||||
},
|
||||
|
||||
datePicker: function(datePickerSelector, changeMonth, day, done) {
|
||||
this.wait(datePickerSelector)
|
||||
.mousedown(datePickerSelector)
|
||||
|
|
|
@ -3,19 +3,19 @@ import components from './components_selectors.js';
|
|||
export default {
|
||||
globalItems: {
|
||||
applicationsMenuButton: '#apps',
|
||||
applicationsMenuVisible: 'vn-main-menu [vn-id="apps-menu"] ul',
|
||||
clientsButton: 'vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="client.index"]',
|
||||
itemsButton: 'vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="item.index"]',
|
||||
ticketsButton: 'vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="ticket.index"]',
|
||||
invoiceOutButton: 'vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="invoiceOut.index"]',
|
||||
claimsButton: 'vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="claim.index"]',
|
||||
applicationsMenuVisible: '.modules-menu',
|
||||
clientsButton: '.modules-menu > li[ui-sref="client.index"]',
|
||||
itemsButton: '.modules-menu > li[ui-sref="item.index"]',
|
||||
ticketsButton: '.modules-menu > li[ui-sref="ticket.index"]',
|
||||
invoiceOutButton: '.modules-menu > li[ui-sref="invoiceOut.index"]',
|
||||
claimsButton: '.modules-menu > li[ui-sref="claim.index"]',
|
||||
returnToModuleIndexButton: 'a[ui-sref="order.index"]',
|
||||
userMenuButton: 'vn-topbar #user',
|
||||
userLocalWarehouse: 'vn-topbar vn-popover vn-autocomplete[field="$ctrl.localWarehouseFk"]',
|
||||
userLocalBank: 'vn-topbar vn-popover vn-autocomplete[field="$ctrl.localBankFk"]',
|
||||
userLocalCompany: 'vn-topbar vn-popover vn-autocomplete[field="$ctrl.localCompanyFk"]',
|
||||
userWarehouse: 'vn-topbar vn-popover vn-autocomplete[field="$ctrl.warehouseFk"]',
|
||||
userCompany: 'vn-topbar vn-popover vn-autocomplete[field="$ctrl.companyFk"]',
|
||||
userLocalWarehouse: '.user-configuration vn-autocomplete[field="$ctrl.localWarehouseFk"]',
|
||||
userLocalBank: '.user-configuration vn-autocomplete[field="$ctrl.localBankFk"]',
|
||||
userLocalCompany: '.user-configuration vn-autocomplete[field="$ctrl.localCompanyFk"]',
|
||||
userWarehouse: '.user-configuration vn-autocomplete[field="$ctrl.warehouseFk"]',
|
||||
userCompany: '.user-configuration vn-autocomplete[field="$ctrl.companyFk"]',
|
||||
userConfigFirstAutocompleteClear: '#localWarehouse > div > div > div > vn-icon.clear',
|
||||
userConfigSecondAutocompleteClear: '#localBank > div > div > div > vn-icon.clear',
|
||||
userConfigThirdAutocompleteClear: '#localCompany > div > div > div > vn-icon.clear',
|
||||
|
@ -45,7 +45,7 @@ export default {
|
|||
},
|
||||
clientDescriptor: {
|
||||
moreMenu: 'vn-client-descriptor vn-icon-menu > div > vn-icon',
|
||||
simpleTicketButton: 'vn-client-descriptor vn-popover > div > div.content > div > div.list > ul > li'
|
||||
simpleTicketButton: '.vn-popover.shown .vn-drop-down li'
|
||||
},
|
||||
clientBasicData: {
|
||||
basicDataButton: 'vn-left-menu a[ui-sref="client.card.basicData"]',
|
||||
|
@ -177,7 +177,7 @@ export default {
|
|||
dms: {
|
||||
deleteFileButton: 'vn-client-dms-index vn-table vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
|
||||
firstDocWorker: 'vn-client-dms-index vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(8) > span',
|
||||
firstDocWorkerDescriptor: 'vn-client-dms-index > vn-worker-descriptor-popover > vn-popover',
|
||||
firstDocWorkerDescriptor: '.vn-popover.shown vn-worker-descriptor',
|
||||
acceptDeleteButton: 'vn-client-dms-index > vn-confirm button[response="ACCEPT"]'
|
||||
},
|
||||
itemsIndex: {
|
||||
|
@ -218,7 +218,7 @@ export default {
|
|||
itemDescriptor: {
|
||||
goBackToModuleIndexButton: 'vn-item-descriptor a[href="#!/item/index"]',
|
||||
moreMenu: 'vn-item-descriptor vn-icon-menu > div > vn-icon',
|
||||
moreMenuRegularizeButton: 'vn-item-descriptor vn-drop-down > vn-popover ul > li[name="Regularize stock"]',
|
||||
moreMenuRegularizeButton: '.vn-popover.shown .vn-drop-down li[name="Regularize stock"]',
|
||||
regularizeQuantityInput: 'vn-item-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-textfield > div > div > div.infix > input',
|
||||
regularizeWarehouseAutocomplete: 'vn-item-descriptor vn-dialog vn-autocomplete[field="$ctrl.warehouseFk"]',
|
||||
editButton: 'vn-item-card vn-item-descriptor vn-float-button[icon="edit"]',
|
||||
|
@ -313,10 +313,10 @@ export default {
|
|||
total: 'vn-ticket-summary vn-one.taxes > p:nth-child(3) > strong',
|
||||
sale: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr',
|
||||
firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span',
|
||||
firstSaleDescriptorImage: 'vn-ticket-summary vn-item-descriptor-popover > vn-popover vn-item-descriptor img',
|
||||
itemDescriptorPopover: 'vn-ticket-summary vn-item-descriptor-popover > vn-popover',
|
||||
itemDescriptorPopoverItemDiaryButton: 'vn-ticket-summary > vn-item-descriptor-popover a[href="#!/item/2/diary?warehouseFk=5&ticketFk=20"]',
|
||||
popoverDiaryButton: 'vn-ticket-summary vn-item-descriptor-popover vn-item-descriptor vn-icon[icon="icon-transaction"]',
|
||||
firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img',
|
||||
itemDescriptorPopover: '.vn-popover.shown vn-item-descriptor',
|
||||
itemDescriptorPopoverItemDiaryButton: 'vn-item-descriptor a[href="#!/item/2/diary?warehouseFk=5&ticketFk=20"]',
|
||||
popoverDiaryButton: '.vn-popover.shown vn-item-descriptor vn-icon[icon="icon-transaction"]',
|
||||
firstSaleQuantity: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3)',
|
||||
firstSaleDiscount: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6)',
|
||||
invoiceOutRef: 'vn-ticket-summary > vn-card > div > vn-horizontal > vn-one:nth-child(1) > vn-label-value:nth-child(6) > section > span',
|
||||
|
@ -324,7 +324,7 @@ export default {
|
|||
},
|
||||
ticketsIndex: {
|
||||
openAdvancedSearchButton: 'vn-ticket-index vn-searchbar t-right-icons > vn-icon[icon="keyboard_arrow_down"]',
|
||||
advancedSearchInvoiceOut: 'vn-ticket-index vn-searchbar vn-ticket-search-panel vn-textfield[model="filter.refFk"] input',
|
||||
advancedSearchInvoiceOut: 'vn-ticket-search-panel vn-textfield[model="filter.refFk"] input',
|
||||
newTicketButton: 'vn-ticket-index > a',
|
||||
searchResult: 'vn-ticket-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr',
|
||||
searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr',
|
||||
|
@ -332,11 +332,11 @@ export default {
|
|||
searchTicketInput: `vn-ticket-index ${components.vnTextfield}`,
|
||||
searchWeeklyTicketInput: `vn-ticket-weekly-index ${components.vnTextfield}`,
|
||||
searchWeeklyClearInput: 'vn-ticket-weekly-index vn-searchbar i[class="material-icons clear"]',
|
||||
advancedSearchButton: 'vn-ticket-index vn-searchbar > vn-popover vn-ticket-search-panel vn-submit[label="Search"] input',
|
||||
advancedSearchButton: 'vn-ticket-search-panel vn-submit[label="Search"] input',
|
||||
searchButton: 'vn-ticket-index vn-searchbar vn-icon[icon="search"]',
|
||||
searchWeeklyButton: 'vn-ticket-weekly-index vn-searchbar vn-icon[icon="search"]',
|
||||
moreMenu: 'vn-ticket-index vn-icon-menu[vn-id="more-button"] > div > vn-icon',
|
||||
moreMenuWeeklyTickets: 'vn-ticket-index vn-icon-menu vn-drop-down > vn-popover li:nth-child(2)',
|
||||
moreMenuWeeklyTickets: '.vn-popover.shown .vn-drop-down li:nth-child(2)',
|
||||
sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6) vn-autocomplete[field="weekly.weekDay"] input',
|
||||
weeklyTicket: 'vn-ticket-weekly-index vn-table > div > vn-tbody > vn-tr',
|
||||
firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
|
||||
|
@ -355,13 +355,13 @@ export default {
|
|||
stateLabelValue: 'vn-ticket-descriptor vn-label-value[label="State"]',
|
||||
goBackToModuleIndexButton: 'vn-ticket-descriptor a[ui-sref="ticket.index"]',
|
||||
moreMenu: 'vn-ticket-descriptor vn-icon-menu > div > vn-icon',
|
||||
moreMenuAddStowaway: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Add stowaway"]',
|
||||
moreMenuDeleteStowawayButton: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Remove stowaway"]',
|
||||
moreMenuAddToTurn: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Add turn"]',
|
||||
moreMenuDeleteTicket: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Delete ticket"]',
|
||||
moreMenuMakeInvoice: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Make invoice"]',
|
||||
moreMenuChangeShippedHour: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Change shipped hour"]',
|
||||
changeShippedHourInput: 'vn-ticket-descriptor > vn-dialog.ng-isolate-scope.vn-dialog.shown vn-input-time input',
|
||||
moreMenuAddStowaway: '.vn-popover.shown .vn-drop-down li[name="Add stowaway"]',
|
||||
moreMenuDeleteStowawayButton: '.vn-popover.shown .vn-drop-down li[name="Remove stowaway"]',
|
||||
moreMenuAddToTurn: '.vn-popover.shown .vn-drop-down li[name="Add turn"]',
|
||||
moreMenuDeleteTicket: '.vn-popover.shown .vn-drop-down li[name="Delete ticket"]',
|
||||
moreMenuMakeInvoice: '.vn-popover.shown .vn-drop-down li[name="Make invoice"]',
|
||||
moreMenuChangeShippedHour: '.vn-popover.shown .vn-drop-down li[name="Change shipped hour"]',
|
||||
changeShippedHourInput: 'vn-ticket-descriptor .vn-dialog.shown vn-input-time input',
|
||||
addStowawayDialogFirstTicket: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog vn-table vn-tbody vn-tr',
|
||||
shipButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks vn-icon[icon="icon-stowaway"]',
|
||||
thursdayButton: 'vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(4)',
|
||||
|
@ -398,21 +398,21 @@ export default {
|
|||
ticketSales: {
|
||||
saleButton: 'vn-left-menu a[ui-sref="ticket.card.sale"]',
|
||||
saleLine: 'vn-table div > vn-tbody > vn-tr',
|
||||
saleDescriptorPopover: 'vn-ticket-sale vn-item-descriptor-popover > vn-popover',
|
||||
saleDescriptorPopoverSummaryButton: 'vn-item-descriptor-popover a[ui-sref="item.card.summary({id: $ctrl.item.id})"]',
|
||||
saleDescriptorPopover: '.vn-popover.shown vn-item-descriptor',
|
||||
saleDescriptorPopoverSummaryButton: '.vn-popover.shown vn-item-descriptor a[ui-sref="item.card.summary({id: $ctrl.item.id})"]',
|
||||
descriptorItemDiaryButton: 'vn-item-descriptor .quicklinks.ng-scope > vn-horizontal > a > vn-icon > i',
|
||||
newItemFromCatalogButton: 'vn-ticket-sale vn-float-button[icon="add"]',
|
||||
newItemButton: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-one > vn-icon-button > button > vn-icon > i',
|
||||
moreMenu: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] > div > button',
|
||||
moreMenuCreateClaim: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] vn-drop-down > vn-popover ul > li[name="Add claim"]',
|
||||
moreMenuReserve: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] vn-drop-down > vn-popover ul > li[name="Mark as reserved"]',
|
||||
moreMenuUnmarkReseved: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] vn-drop-down > vn-popover ul > li[name="Unmark as reserved"]',
|
||||
moreMenuUpdateDiscount: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] vn-drop-down > vn-popover ul > li[name="Update discount"]',
|
||||
moreMenuCreateClaim: '.vn-popover.shown .vn-drop-down li[name="Add claim"]',
|
||||
moreMenuReserve: '.vn-popover.shown .vn-drop-down li[name="Mark as reserved"]',
|
||||
moreMenuUnmarkReseved: '.vn-popover.shown .vn-drop-down li[name="Unmark as reserved"]',
|
||||
moreMenuUpdateDiscount: '.vn-popover.shown .vn-drop-down li[name="Update discount"]',
|
||||
moreMenuUpdateDiscountInput: 'vn-ticket-sale vn-dialog form vn-ticket-sale-edit-discount vn-input-number[model="$ctrl.newDiscount"] input',
|
||||
transferQuantityInput: 'vn-ticket-sale vn-popover.transfer.ng-isolate-scope.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable > span > text',
|
||||
transferQuantityCell: 'vn-ticket-sale vn-popover.transfer.ng-isolate-scope.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable',
|
||||
transferQuantityInput: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable > span > text',
|
||||
transferQuantityCell: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable',
|
||||
firstSaleClaimIcon: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) vn-icon[icon="icon-claims"]',
|
||||
firstSaleDescriptorImage: 'vn-ticket-sale vn-item-descriptor-popover > vn-popover vn-item-descriptor img',
|
||||
firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img',
|
||||
firstSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(1)',
|
||||
firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) vn-td:nth-child(3) > img',
|
||||
firstSaleZoomedImage: 'body > div > div > img',
|
||||
|
@ -421,9 +421,9 @@ export default {
|
|||
firstSaleQuantityClearInput: 'vn-textfield[model="sale.quantity"] div.suffix > i',
|
||||
firstSaleIdInput: 'body > vn-app > div > ui-view > vn-ticket-card > vn-main-block > div > vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > vn-autocomplete > div > div > input',
|
||||
firstSaleIdAutocomplete: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > vn-autocomplete',
|
||||
idAutocompleteFirstResult: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete > vn-drop-down > vn-popover > div > div.content > div > div.list > ul > li',
|
||||
idAutocompleteFirstResult: '.vn-popover.shown .vn-drop-down li',
|
||||
firstSalePrice: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(7) > span',
|
||||
firstSalePriceInput: 'vn-ticket-sale:nth-child(1) vn-popover.edit.dialog-summary.ng-isolate-scope.vn-popover.shown vn-input-number input',
|
||||
firstSalePriceInput: '.vn-popover.shown vn-input-number input',
|
||||
firstSaleDiscount: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(8) > span',
|
||||
firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount vn-input-number input',
|
||||
firstSaleImport: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(9)',
|
||||
|
@ -449,10 +449,10 @@ export default {
|
|||
thirdSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(3) vn-check[field="sale.checked"] md-checkbox',
|
||||
deleteSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="delete"]',
|
||||
transferSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="call_split"]',
|
||||
moveToTicketInput: 'vn-ticket-sale vn-popover.transfer vn-textfield[model="$ctrl.transfer.ticketId"] input',
|
||||
moveToTicketInputClearButton: 'vn-popover.shown i[title="Clear"]',
|
||||
moveToTicketButton: 'vn-ticket-sale vn-popover.transfer vn-icon[icon="arrow_forward_ios"]',
|
||||
moveToNewTicketButton: 'vn-ticket-sale vn-popover.transfer vn-button[label="New ticket"]',
|
||||
moveToTicketInput: '.vn-popover.shown vn-textfield[model="$ctrl.transfer.ticketId"] input',
|
||||
moveToTicketInputClearButton: '.vn-popover.shown i[title="Clear"]',
|
||||
moveToTicketButton: '.vn-popover.shown vn-icon[icon="arrow_forward_ios"]',
|
||||
moveToNewTicketButton: '.vn-popover.shown vn-button[label="New ticket"]',
|
||||
acceptDeleteLineButton: 'vn-ticket-sale > vn-confirm[vn-id="delete-lines"] button[response=ACCEPT]',
|
||||
acceptDeleteTicketButton: 'vn-ticket-sale > vn-confirm[vn-id="delete-ticket"] button[response=ACCEPT]',
|
||||
stateMenuButton: 'vn-ticket-sale vn-tool-bar > vn-button-menu[label="State"]'
|
||||
|
@ -524,7 +524,7 @@ export default {
|
|||
},
|
||||
claimDescriptor: {
|
||||
moreMenu: 'vn-claim-descriptor vn-icon-menu[vn-id="more-button"]',
|
||||
moreMenuDeleteClaim: 'vn-claim-descriptor vn-icon-menu vn-drop-down li[name="Delete claim"]',
|
||||
moreMenuDeleteClaim: '.vn-popover.shown .vn-drop-down li[name="Delete claim"]',
|
||||
acceptDeleteClaim: 'vn-claim-descriptor > vn-confirm[vn-id="confirm-delete-claim"] button[response="ACCEPT"]'
|
||||
},
|
||||
claimSummary: {
|
||||
|
@ -532,13 +532,13 @@ export default {
|
|||
state: 'vn-claim-summary vn-label-value[label="State"] > section > span',
|
||||
observation: 'vn-claim-summary vn-textarea[model="$ctrl.summary.claim.observation"] > div > textarea',
|
||||
firstSaleItemId: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(4) > vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(1) > span',
|
||||
firstSaleDescriptorImage: 'vn-claim-summary vn-item-descriptor-popover > vn-popover vn-item-descriptor img',
|
||||
itemDescriptorPopover: 'vn-claim-summary vn-item-descriptor-popover > vn-popover',
|
||||
itemDescriptorPopoverItemDiaryButton: 'vn-claim-summary > vn-item-descriptor-popover a[href="#!/item/2/diary"]',
|
||||
firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img',
|
||||
itemDescriptorPopover: '.vn-popover.shown vn-item-descriptor',
|
||||
itemDescriptorPopoverItemDiaryButton: '.vn-popover.shown vn-item-descriptor a[href="#!/item/2/diary"]',
|
||||
firstDevelopmentWorker: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(5) > vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > span',
|
||||
firstDevelopmentWorkerGoToClientButton: 'vn-claim-summary > vn-worker-descriptor-popover > vn-popover vn-worker-descriptor div.quicklinks > a[href="#!/client/21/summary"]',
|
||||
firstDevelopmentWorkerGoToClientButton: '.vn-popover.shown vn-worker-descriptor div.quicklinks > a[href="#!/client/21/summary"]',
|
||||
firstActionTicketId: 'vn-claim-summary > vn-card > div > vn-horizontal > vn-auto:nth-child(6) > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span',
|
||||
firstActionTicketDescriptor: 'vn-claim-summary > vn-ticket-descriptor-popover > vn-popover > div > div.content > vn-ticket-descriptor'
|
||||
firstActionTicketDescriptor: '.vn-popover.shown vn-ticket-descriptor'
|
||||
},
|
||||
claimBasicData: {
|
||||
claimStateAutocomplete: 'vn-claim-basic-data vn-autocomplete[field="$ctrl.claim.claimStateFk"]',
|
||||
|
@ -548,8 +548,8 @@ export default {
|
|||
},
|
||||
claimDetail: {
|
||||
secondItemDiscount: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(6) > span',
|
||||
discountInput: 'vn-claim-detail vn-popover vn-input-number[model="$ctrl.newDiscount"] > div > div > div.infix > input',
|
||||
discoutPopoverMana: 'vn-claim-detail > vn-popover > div > div.content > div > vn-horizontal > h5',
|
||||
discountInput: '.vn-popover.shown vn-input-number[model="$ctrl.newDiscount"] > div > div > div.infix > input',
|
||||
discoutPopoverMana: '.vn-popover.shown .content > div > vn-horizontal > h5',
|
||||
addItemButton: 'vn-claim-detail a vn-float-button',
|
||||
firstClaimableSaleFromTicket: 'vn-claim-detail > vn-dialog vn-tbody > vn-tr',
|
||||
claimDetailLine: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr',
|
||||
|
@ -575,7 +575,7 @@ export default {
|
|||
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)',
|
||||
secondImportableTicket: '.vn-popover.shown .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"]',
|
||||
secondLineDestination: 'vn-claim-action vn-tr:nth-child(2) vn-autocomplete[field="saleClaimed.claimDestinationFk"]',
|
||||
firstDeleteLine: 'vn-claim-action vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
|
||||
|
@ -608,9 +608,9 @@ export default {
|
|||
itemIdInput: 'vn-order-catalog > vn-side-menu vn-catalog-filter vn-textfield[model="$ctrl.itemFk"] input',
|
||||
itemTagValueInput: 'vn-order-catalog > vn-side-menu vn-catalog-filter vn-textfield[model="$ctrl.value"] input',
|
||||
openTagSearch: 'vn-order-catalog > vn-side-menu > div > vn-catalog-filter > div > vn-vertical > vn-textfield[model="$ctrl.value"] > div > div > div.rightIcons > t-right-icons > i',
|
||||
tagAutocomplete: 'vn-order-catalog > vn-side-menu vn-catalog-filter vn-popover vn-order-catalog-search-panel vn-autocomplete[field="filter.tagFk"]',
|
||||
tagValueInput: 'vn-order-catalog > vn-side-menu vn-catalog-filter vn-popover vn-order-catalog-search-panel vn-textfield[model="filter.value"] input',
|
||||
searchTagButton: 'vn-order-catalog > vn-side-menu vn-catalog-filter vn-popover vn-order-catalog-search-panel > div > form > vn-horizontal:nth-child(3) > vn-submit > input',
|
||||
tagAutocomplete: 'vn-order-catalog-search-panel vn-autocomplete[field="filter.tagFk"]',
|
||||
tagValueInput: 'vn-order-catalog-search-panel vn-textfield[model="filter.value"] input',
|
||||
searchTagButton: 'vn-order-catalog-search-panel > div > form > vn-horizontal:nth-child(3) > vn-submit > input',
|
||||
thirdFilterRemoveButton: 'vn-order-catalog > vn-side-menu vn-catalog-filter > div > vn-horizontal.chips > vn-chip:nth-child(3) button',
|
||||
fourthFilterRemoveButton: 'vn-order-catalog > vn-side-menu vn-catalog-filter > div > vn-horizontal.chips > vn-chip:nth-child(4) button',
|
||||
},
|
||||
|
@ -727,9 +727,9 @@ export default {
|
|||
},
|
||||
invoiceOutDescriptor: {
|
||||
moreMenu: 'vn-invoice-out-descriptor vn-icon-menu[vn-id="more-button"]',
|
||||
moreMenuDeleteInvoiceOut: 'vn-invoice-out-descriptor vn-popover li[name="Delete Invoice"]',
|
||||
moreMenuBookInvoiceOut: 'vn-invoice-out-descriptor vn-popover li[name="Book invoice"]',
|
||||
moreMenuShowInvoiceOutPdf: 'vn-invoice-out-descriptor vn-popover li[name="Show invoice PDF"]',
|
||||
moreMenuDeleteInvoiceOut: '.vn-popover.shown .vn-drop-down li[name="Delete Invoice"]',
|
||||
moreMenuBookInvoiceOut: '.vn-popover.shown .vn-drop-down li[name="Book invoice"]',
|
||||
moreMenuShowInvoiceOutPdf: '.vn-popover.shown .vn-drop-down li[name="Show invoice PDF"]',
|
||||
acceptDeleteButton: 'vn-invoice-out-descriptor > vn-confirm[vn-id="deleteConfirmation"] button[response="ACCEPT"]',
|
||||
acceptBookingButton: 'vn-invoice-out-descriptor > vn-confirm[vn-id="bookConfirmation"] button[response="ACCEPT"]'
|
||||
},
|
||||
|
|
|
@ -24,7 +24,7 @@ describe('Client DMS', () => {
|
|||
it(`should click on the first document line worker name making the descriptor visible`, async() => {
|
||||
const visible = await nightmare
|
||||
.waitToClick(selectors.dms.firstDocWorker)
|
||||
.waitForClassPresent(selectors.dms.firstDocWorkerDescriptor, 'shown')
|
||||
.wait(selectors.dms.firstDocWorkerDescriptor)
|
||||
.isVisible(selectors.dms.firstDocWorkerDescriptor);
|
||||
|
||||
expect(visible).toBeTruthy();
|
||||
|
|
|
@ -17,8 +17,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '07:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
||||
|
||||
|
@ -29,8 +28,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '10:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
|
||||
|
||||
|
@ -41,8 +39,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '15:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
||||
|
||||
|
@ -53,8 +50,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText');
|
||||
|
||||
|
@ -82,8 +78,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '08:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText');
|
||||
|
||||
|
@ -94,8 +89,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '10:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText');
|
||||
|
||||
|
@ -106,8 +100,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText');
|
||||
|
||||
|
@ -118,8 +111,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '16:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText');
|
||||
|
||||
|
@ -139,8 +131,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '09:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText');
|
||||
|
||||
|
@ -151,8 +142,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '10:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText');
|
||||
|
||||
|
@ -163,8 +153,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText');
|
||||
|
||||
|
@ -175,8 +164,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '17:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText');
|
||||
|
||||
|
@ -196,8 +184,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '09:59';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText');
|
||||
|
||||
|
@ -208,8 +195,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '10:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText');
|
||||
|
||||
|
@ -220,8 +206,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText');
|
||||
|
||||
|
@ -232,8 +217,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '17:59';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText');
|
||||
|
||||
|
@ -253,8 +237,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '07:30';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText');
|
||||
|
||||
|
@ -265,8 +248,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '10:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText');
|
||||
|
||||
|
@ -277,8 +259,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '10:20';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText');
|
||||
|
||||
|
@ -289,8 +270,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '15:30';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText');
|
||||
|
||||
|
@ -319,8 +299,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '06:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText');
|
||||
|
||||
|
@ -331,8 +310,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '13:40';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText');
|
||||
|
||||
|
@ -352,8 +330,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '05:00';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.sundayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText');
|
||||
|
||||
|
@ -364,8 +341,7 @@ describe('Worker time control path', () => {
|
|||
const scanTime = '12:40';
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.sundayAddTimeButton)
|
||||
.clearInput(selectors.workerTimeControl.timeDialogInput)
|
||||
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
||||
.waitToClick(selectors.workerTimeControl.confirmButton)
|
||||
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText');
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
|
||||
describe('Ticket descriptor path', () => {
|
||||
fdescribe('Ticket descriptor path', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
beforeAll(() => {
|
||||
|
@ -43,7 +43,7 @@ describe('Ticket descriptor path', () => {
|
|||
|
||||
it(`should update the shipped hour`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketDescriptor.changeShippedHourInput, '0815')
|
||||
.pickTime(selectors.ticketDescriptor.changeShippedHourInput, '08:15')
|
||||
.waitToClick(selectors.ticketDescriptor.acceptChangeHourButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
|
@ -116,7 +116,6 @@ describe('Ticket descriptor path', () => {
|
|||
.wait(selectors.ticketDescriptor.addStowawayDialogFirstTicket)
|
||||
.isVisible(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
|
||||
|
||||
|
||||
expect(isVisible).toBeTruthy();
|
||||
});
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ describe('claim Summary path', () => {
|
|||
.exists(selectors.claimSummary.itemDescriptorPopoverItemDiaryButton);
|
||||
|
||||
expect(exists).toBeTruthy();
|
||||
await nightmare.mousedown('.vn-popover.shown');
|
||||
});
|
||||
|
||||
it('should display the claim development details', async() => {
|
||||
|
@ -82,6 +83,7 @@ describe('claim Summary path', () => {
|
|||
.exists(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton);
|
||||
|
||||
expect(exists).toBeTruthy();
|
||||
await nightmare.mousedown('.vn-popover.shown');
|
||||
});
|
||||
|
||||
it(`should click on the first action ticket ID making the ticket descriptor visible`, async() => {
|
||||
|
|
|
@ -36,6 +36,7 @@ describe('claim Descriptor path', () => {
|
|||
it(`should be able to see the delete claim button of the descriptor more menu`, async() => {
|
||||
let exists = await nightmare
|
||||
.waitToClick(selectors.claimDescriptor.moreMenu)
|
||||
.wait(selectors.claimDescriptor.moreMenuDeleteClaim)
|
||||
.exists(selectors.claimDescriptor.moreMenuDeleteClaim);
|
||||
|
||||
expect(exists).toBeTruthy();
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import ngModule from '../../module';
|
||||
require('./style.scss');
|
||||
|
||||
directive.$inject = ['vnTemplate'];
|
||||
export default function directive(vnTemplate) {
|
||||
export default function directive() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
|
|
|
@ -2,17 +2,19 @@
|
|||
vn-id="popover"
|
||||
on-open="$ctrl.onOpen()"
|
||||
on-close="$ctrl.onClose()">
|
||||
<div class="dropdown">
|
||||
<div class="vn-drop-down">
|
||||
<div ng-show="$ctrl.showFilter" class="filter">
|
||||
<vn-textfield
|
||||
vn-id="input"
|
||||
model="$ctrl.search"
|
||||
class="search"
|
||||
ng-blur="$ctrl.onFocusOut()"
|
||||
label="Search">
|
||||
</vn-textfield>
|
||||
</div>
|
||||
<div class="list" tabindex="-1">
|
||||
<div vn-id="list" class="list" tabindex="-1">
|
||||
<ul
|
||||
vn-id="ul"
|
||||
class="dropdown"
|
||||
ng-click="$ctrl.onContainerClick($event)">
|
||||
</ul>
|
||||
|
|
|
@ -31,10 +31,7 @@ export default class DropDown extends Component {
|
|||
|
||||
$postLink() {
|
||||
super.$postLink();
|
||||
this.input = this.element.querySelector('.search input');
|
||||
this.ul = this.element.querySelector('ul');
|
||||
this.list = this.element.querySelector('.list');
|
||||
this.list.addEventListener('scroll', e => this.onScroll(e));
|
||||
this.$.list.addEventListener('scroll', e => this.onScroll(e));
|
||||
}
|
||||
|
||||
get shown() {
|
||||
|
@ -129,7 +126,7 @@ export default class DropDown extends Component {
|
|||
moveToOption(option) {
|
||||
this.activateOption(option);
|
||||
|
||||
let list = this.list;
|
||||
let list = this.$.list;
|
||||
let li = this.activeLi;
|
||||
if (!li) return;
|
||||
|
||||
|
@ -156,7 +153,7 @@ export default class DropDown extends Component {
|
|||
let data = this.modelData;
|
||||
|
||||
if (option >= 0 && data && option < data.length) {
|
||||
this.activeLi = this.ul.children[option];
|
||||
this.activeLi = this.$.ul.children[option];
|
||||
this.activeLi.className = 'active';
|
||||
}
|
||||
}
|
||||
|
@ -195,8 +192,8 @@ export default class DropDown extends Component {
|
|||
|
||||
onOpen() {
|
||||
this.document.addEventListener('keydown', this.docKeyDownHandler);
|
||||
this.list.scrollTop = 0;
|
||||
this.input.focus();
|
||||
this.$.list.scrollTop = 0;
|
||||
this.$.input.focus();
|
||||
}
|
||||
|
||||
onClose() {
|
||||
|
@ -208,7 +205,7 @@ export default class DropDown extends Component {
|
|||
}
|
||||
|
||||
onScroll() {
|
||||
let list = this.list;
|
||||
let list = this.$.list;
|
||||
let shouldLoad =
|
||||
list.scrollTop + list.clientHeight >= (list.scrollHeight - 40)
|
||||
&& !this.model.isLoading;
|
||||
|
@ -225,7 +222,7 @@ export default class DropDown extends Component {
|
|||
|
||||
onContainerClick(event) {
|
||||
if (event.defaultPrevented) return;
|
||||
let index = getPosition(this.ul, event);
|
||||
let index = getPosition(this.$.ul, event);
|
||||
if (index != -1) {
|
||||
event.preventDefault();
|
||||
this.selectOption(index);
|
||||
|
@ -312,13 +309,13 @@ export default class DropDown extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
this.ul.appendChild(fragment);
|
||||
this.$.ul.appendChild(fragment);
|
||||
this.activateOption(this._activeOption);
|
||||
this.$.$applyAsync(() => this.$.popover.relocate());
|
||||
}
|
||||
|
||||
destroyList() {
|
||||
this.ul.innerHTML = '';
|
||||
this.$.ul.innerHTML = '';
|
||||
|
||||
if (this.scopes) {
|
||||
for (let scope of this.scopes)
|
||||
|
|
|
@ -1,79 +1,77 @@
|
|||
@import "effects";
|
||||
@import "variables";
|
||||
|
||||
vn-drop-down {
|
||||
.dropdown {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: inherit;
|
||||
.vn-drop-down {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: inherit;
|
||||
|
||||
& > .filter {
|
||||
position: relative;
|
||||
& > .filter {
|
||||
position: relative;
|
||||
|
||||
& > .search {
|
||||
display: block;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
border: none;
|
||||
font-size: inherit;
|
||||
padding: .6em;
|
||||
margin: 0!important;
|
||||
&.not-empty label{
|
||||
display: none;
|
||||
}
|
||||
& .selected label {
|
||||
font-size: inherit;
|
||||
bottom: 2px;
|
||||
color: $color-font-secondary;
|
||||
}
|
||||
}
|
||||
& > vn-icon[icon=clear] {
|
||||
& > .search {
|
||||
display: block;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
border: none;
|
||||
font-size: inherit;
|
||||
padding: .6em;
|
||||
margin: 0!important;
|
||||
&.not-empty label{
|
||||
display: none;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
right: .5em;
|
||||
top: .6em;
|
||||
height: 1em;
|
||||
color: #888;
|
||||
border-radius: 50%;
|
||||
background-color: rgba(255, 255, 255, .8);
|
||||
font-size: 18px;
|
||||
|
||||
&:hover {
|
||||
color: $color-font;
|
||||
}
|
||||
}
|
||||
&:hover > vn-icon[icon=clear] {
|
||||
display: block;
|
||||
& .selected label {
|
||||
font-size: inherit;
|
||||
bottom: 2px;
|
||||
color: $color-font-secondary;
|
||||
}
|
||||
}
|
||||
& > .list {
|
||||
max-height: 20em;
|
||||
overflow: auto;
|
||||
& > vn-icon[icon=clear] {
|
||||
display: none;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
right: .5em;
|
||||
top: .6em;
|
||||
height: 1em;
|
||||
color: #888;
|
||||
border-radius: 50%;
|
||||
background-color: rgba(255, 255, 255, .8);
|
||||
font-size: 18px;
|
||||
|
||||
&:hover {
|
||||
color: $color-font;
|
||||
}
|
||||
}
|
||||
&:hover > vn-icon[icon=clear] {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
& > .list {
|
||||
max-height: 20em;
|
||||
overflow: auto;
|
||||
|
||||
ul {
|
||||
padding: 0;
|
||||
ul {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style-type: none;
|
||||
}
|
||||
li, .status {
|
||||
@extend %clickable;
|
||||
padding: .6em;
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
|
||||
& > input[type=checkbox] {
|
||||
margin: 0;
|
||||
list-style-type: none;
|
||||
margin-right: .6em;
|
||||
}
|
||||
li, .status {
|
||||
@extend %clickable;
|
||||
padding: .6em;
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
|
||||
& > input[type=checkbox] {
|
||||
margin: 0;
|
||||
margin-right: .6em;
|
||||
}
|
||||
&.active {
|
||||
@extend %active;
|
||||
}
|
||||
}
|
||||
.status {
|
||||
color: $color-main;
|
||||
font-weight: bold;
|
||||
&.active {
|
||||
@extend %active;
|
||||
}
|
||||
}
|
||||
.status {
|
||||
color: $color-main;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ export default class InputNumber extends Input {
|
|||
this.hasFocus = false;
|
||||
|
||||
vnTemplate.normalizeInputAttrs($attrs);
|
||||
|
||||
this.registerEvents();
|
||||
}
|
||||
|
||||
|
@ -107,10 +106,6 @@ export default class InputNumber extends Input {
|
|||
if (value) this.input.step = value;
|
||||
}
|
||||
|
||||
get validationError() {
|
||||
return this.input.validationMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increases the input value
|
||||
*/
|
||||
|
@ -124,61 +119,7 @@ export default class InputNumber extends Input {
|
|||
stepDown() {
|
||||
this.input.stepDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a valid input value
|
||||
*
|
||||
* @return {Boolean} - True if has a valid value
|
||||
*/
|
||||
hasValidValue() {
|
||||
return this.input.checkValidity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the input element
|
||||
* if has a validation error
|
||||
*/
|
||||
validateValue() {
|
||||
if (!this.hasValidValue()) {
|
||||
this.hideError();
|
||||
this.showError();
|
||||
} else
|
||||
this.hideError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the input validation error
|
||||
*/
|
||||
showError() {
|
||||
const infixElement = this.element.querySelector('.infix');
|
||||
const infixClassList = infixElement.classList;
|
||||
|
||||
const errorSpan = document.createElement('span');
|
||||
errorSpan.className = 'mdl-textfield__error';
|
||||
|
||||
const errorText = document.createTextNode(this.validationError);
|
||||
|
||||
errorSpan.append(errorText);
|
||||
infixElement.append(errorSpan);
|
||||
|
||||
infixClassList.add('validated', 'invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the input validation error
|
||||
*/
|
||||
hideError() {
|
||||
const infixElement = this.element.querySelector('.infix');
|
||||
const infixClassList = infixElement.classList;
|
||||
const errorElement = this.element.querySelector('.infix span.mdl-textfield__error');
|
||||
|
||||
if (errorElement)
|
||||
errorElement.remove();
|
||||
|
||||
infixClassList.remove('validated', 'invalid');
|
||||
}
|
||||
}
|
||||
|
||||
InputNumber.$inject = ['$element', '$scope', '$attrs', 'vnTemplate'];
|
||||
|
||||
ngModule.component('vnInputNumber', {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
vn-input-number {
|
||||
@extend vn-textfield;
|
||||
input {
|
||||
text-align: center!important;
|
||||
text-align: center !important;
|
||||
}
|
||||
vn-icon[icon=add],
|
||||
vn-icon[icon=remove]{
|
||||
|
|
|
@ -5,14 +5,11 @@
|
|||
<div class="infix">
|
||||
<input
|
||||
class="mdl-textfield__input"
|
||||
type="time"
|
||||
ng-model="$ctrl.value"
|
||||
vn-validation="{{$ctrl.rule}}"
|
||||
type="time"
|
||||
ng-disabled="$ctrl.disabled"
|
||||
ng-readonly="$ctrl.readonly"
|
||||
ng-focus="$ctrl.hasFocus = true"
|
||||
ng-blur="$ctrl.hasFocus = false"
|
||||
tabindex="{{$ctrl.input.tabindex}}"/>
|
||||
ng-blur="$ctrl.hasFocus = false"/>
|
||||
<label class="label" translate>{{::$ctrl.label}}</label>
|
||||
</div>
|
||||
<div class="underline"></div>
|
||||
|
|
|
@ -3,17 +3,16 @@ import Input from '../../lib/input';
|
|||
import './style.scss';
|
||||
|
||||
export default class InputTime extends Input {
|
||||
constructor($element, $scope) {
|
||||
constructor($element, $scope, $filter) {
|
||||
super($element, $scope);
|
||||
this.$filter = $filter;
|
||||
|
||||
this.registerEvents();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers all event emitters
|
||||
*/
|
||||
registerEvents() {
|
||||
this.input.addEventListener('change', event => {
|
||||
this.onTimeChange();
|
||||
this.emit('change', {event});
|
||||
});
|
||||
|
||||
|
@ -35,147 +34,31 @@ export default class InputTime extends Input {
|
|||
* @param {Number} value - Value
|
||||
*/
|
||||
set value(value) {
|
||||
if (this._value === undefined && value || typeof value === 'string')
|
||||
value = this.formatTime(value);
|
||||
this.updateValue(value);
|
||||
this.input.value = this.$filter('date')(value, 'HH:mm');
|
||||
}
|
||||
|
||||
updateValue(value) {
|
||||
this._value = value;
|
||||
this.hasValue = !(value === null || value === undefined);
|
||||
|
||||
if (this.hasValue)
|
||||
this.element.classList.add('not-empty');
|
||||
else
|
||||
this.element.classList.remove('not-empty');
|
||||
|
||||
this.element.classList.toggle('not-empty', value != null);
|
||||
this.validateValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets max value
|
||||
*/
|
||||
get max() {
|
||||
return this.input.max;
|
||||
}
|
||||
onTimeChange() {
|
||||
let date = null;
|
||||
let value = this.input.value;
|
||||
|
||||
/**
|
||||
* Sets max allowed value
|
||||
*
|
||||
* @param {Number} value - Value
|
||||
*/
|
||||
set max(value) {
|
||||
if (value) this.input.max = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets min value
|
||||
*/
|
||||
get min() {
|
||||
return this.input.min;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets min allowed value
|
||||
*
|
||||
* @param {Number} value - Value
|
||||
*/
|
||||
set min(value) {
|
||||
if (value) this.input.min = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets min step value
|
||||
*/
|
||||
get step() {
|
||||
return parseInt(this.input.step);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets min step value
|
||||
*
|
||||
* @param {Number} value - Value
|
||||
*/
|
||||
set step(value) {
|
||||
if (value) this.input.step = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a formatted hour
|
||||
* @param {Date} date -a
|
||||
* @return {String} Formatted hour
|
||||
*/
|
||||
formatTime(date) {
|
||||
if (typeof date === 'string') {
|
||||
date = new Date(date);
|
||||
date.setTime(date.getTime() + (date.getTimezoneOffset() * 60000));
|
||||
if (value) {
|
||||
let split = value.split(':').map(i => parseInt(i) || null);
|
||||
date = new Date(this.value || null);
|
||||
date.setHours(split[0], split[1], 0, 0);
|
||||
}
|
||||
|
||||
date.setSeconds(null);
|
||||
date.setMilliseconds(null);
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns native validation message
|
||||
*/
|
||||
get validationError() {
|
||||
return this.input.validationMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a valid input value
|
||||
*
|
||||
* @return {Boolean} - True if has a valid value
|
||||
*/
|
||||
hasValidValue() {
|
||||
return this.input.checkValidity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the input element
|
||||
* if has a validation error
|
||||
*/
|
||||
validateValue() {
|
||||
if (!this.hasValidValue()) {
|
||||
this.hideError();
|
||||
this.showError();
|
||||
} else
|
||||
this.hideError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the input validation error
|
||||
*/
|
||||
showError() {
|
||||
const infixElement = this.element.querySelector('.infix');
|
||||
const infixClassList = infixElement.classList;
|
||||
|
||||
const errorSpan = document.createElement('span');
|
||||
errorSpan.className = 'mdl-textfield__error';
|
||||
|
||||
const errorText = document.createTextNode(this.validationError);
|
||||
|
||||
errorSpan.append(errorText);
|
||||
infixElement.append(errorSpan);
|
||||
|
||||
infixClassList.add('validated', 'invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the input validation error
|
||||
*/
|
||||
hideError() {
|
||||
const infixElement = this.element.querySelector('.infix');
|
||||
const infixClassList = infixElement.classList;
|
||||
const errorElement = this.element.querySelector('.infix span.mdl-textfield__error');
|
||||
|
||||
if (errorElement)
|
||||
errorElement.remove();
|
||||
|
||||
infixClassList.remove('validated', 'invalid');
|
||||
this.updateValue(date);
|
||||
}
|
||||
}
|
||||
|
||||
InputTime.$inject = ['$element', '$scope', '$attrs', 'vnTemplate', '$transclude'];
|
||||
InputTime.$inject = ['$element', '$scope', '$filter'];
|
||||
|
||||
ngModule.component('vnInputTime', {
|
||||
template: require('./index.html'),
|
||||
|
@ -188,9 +71,6 @@ ngModule.component('vnInputTime', {
|
|||
label: '@?',
|
||||
disabled: '<?',
|
||||
readonly: '<?',
|
||||
step: '<?',
|
||||
min: '<?',
|
||||
max: '<?',
|
||||
rule: '@?',
|
||||
value: '=model',
|
||||
vnTabIndex: '@?',
|
||||
|
|
|
@ -6,7 +6,7 @@ vn-input-time {
|
|||
|
||||
input[type="time"] {
|
||||
clip-path: inset(0 17px 0 0);
|
||||
outline:none;
|
||||
outline:0;
|
||||
outline: none;
|
||||
outline: 0;
|
||||
}
|
||||
}
|
|
@ -4,12 +4,8 @@ import Popover from '../popover/popover';
|
|||
export default class Menu extends Popover {
|
||||
$postLink() {
|
||||
super.$postLink();
|
||||
this.element.addEventListener('click',
|
||||
() => this.onClick());
|
||||
}
|
||||
|
||||
onClick() {
|
||||
this.hide();
|
||||
this.popover.addEventListener('click',
|
||||
() => this.hide());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<div class="vn-popover">
|
||||
<div class="popover">
|
||||
<div class="arrow"></div>
|
||||
<div class="content" ng-transclude></div>
|
||||
<div class="content"></div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,5 +1,6 @@
|
|||
import ngModule from '../../module';
|
||||
import Component from '../../lib/component';
|
||||
import template from './popover.html';
|
||||
import './style.scss';
|
||||
|
||||
/**
|
||||
|
@ -11,30 +12,26 @@ import './style.scss';
|
|||
* @event close Thrown when popover is hidden
|
||||
*/
|
||||
export default class Popover extends Component {
|
||||
constructor($element, $scope, $timeout, $transitions) {
|
||||
constructor($element, $scope, $timeout, $transitions, $transclude, $compile) {
|
||||
super($element, $scope);
|
||||
this.$timeout = $timeout;
|
||||
this.$transitions = $transitions;
|
||||
this._shown = false;
|
||||
}
|
||||
|
||||
$postLink() {
|
||||
super.$postLink();
|
||||
this.$element.addClass('vn-popover');
|
||||
|
||||
this.docKeyDownHandler = e => this.onDocKeyDown(e);
|
||||
this.docFocusInHandler = e => this.onDocFocusIn(e);
|
||||
this.bgMouseDownHandler = e => this.onBgMouseDown(e);
|
||||
|
||||
this.element.addEventListener('focusin',
|
||||
e => this.onFocusIn(e));
|
||||
this.element = $compile(template)($scope)[0];
|
||||
|
||||
this.popover = this.element.querySelector('.popover');
|
||||
this.popover.addEventListener('mousedown',
|
||||
e => this.onMouseDown(e));
|
||||
this.popover.addEventListener('mousedown', e => this.onMouseDown(e));
|
||||
|
||||
this.arrow = this.element.querySelector('.arrow');
|
||||
this.content = this.element.querySelector('.content');
|
||||
|
||||
$transclude($scope.$parent,
|
||||
clone => angular.element(this.content).append(clone));
|
||||
}
|
||||
|
||||
$onDestroy() {
|
||||
this.hide();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,33 +71,23 @@ export default class Popover extends Component {
|
|||
|
||||
if (parent) this.parent = parent;
|
||||
|
||||
let isDescriptorMoreMenu = parent && parent.attributes[0].nodeValue == 'more-button';
|
||||
let leftMenu = this.document.querySelector('div[class="menu left"]');
|
||||
if (isDescriptorMoreMenu && leftMenu) {
|
||||
let descriptorDiv = this.document.querySelector('vn-side-menu div[class="vn-descriptor"]');
|
||||
let leftMenuWidth = leftMenu.offsetWidth;
|
||||
this._shown = true;
|
||||
|
||||
let descriptorWidth = descriptorDiv.offsetWidth;
|
||||
this.scrollbarWidth = leftMenuWidth - descriptorWidth;
|
||||
let newWidth = leftMenuWidth - this.scrollbarWidth;
|
||||
|
||||
leftMenu.style.overflow = 'hidden';
|
||||
leftMenu.style.minWidth = `${newWidth}px`;
|
||||
leftMenu.style.width = `${newWidth}px`;
|
||||
|
||||
this.restoreOverflow = true;
|
||||
if (!this.showTimeout) {
|
||||
this.document.body.appendChild(this.element);
|
||||
this.element.style.display = 'block';
|
||||
}
|
||||
|
||||
this._shown = true;
|
||||
this.element.style.display = 'block';
|
||||
this.$timeout.cancel(this.showTimeout);
|
||||
this.showTimeout = this.$timeout(() => {
|
||||
this.$element.addClass('shown');
|
||||
this.showTimeout = null;
|
||||
this.element.classList.add('shown');
|
||||
}, 30);
|
||||
|
||||
this.docKeyDownHandler = e => this.onDocKeyDown(e);
|
||||
this.document.addEventListener('keydown', this.docKeyDownHandler);
|
||||
this.document.addEventListener('focusin', this.docFocusInHandler);
|
||||
|
||||
this.bgMouseDownHandler = e => this.onBgMouseDown(e);
|
||||
this.element.addEventListener('mousedown', this.bgMouseDownHandler);
|
||||
|
||||
this.deregisterCallback = this.$transitions.onStart({}, () => this.hide());
|
||||
|
@ -114,28 +101,22 @@ export default class Popover extends Component {
|
|||
hide() {
|
||||
if (!this._shown) return;
|
||||
|
||||
if (this.restoreOverflow) {
|
||||
const leftMenu = this.document.querySelector('div[class="menu left"]');
|
||||
let leftMenuWidth = parseInt(leftMenu.style.width);
|
||||
let newWidth = leftMenuWidth + this.scrollbarWidth;
|
||||
leftMenu.style.overflow = 'auto';
|
||||
leftMenu.style.minWidth = `${newWidth}px`;
|
||||
leftMenu.style.width = `${newWidth}px`;
|
||||
|
||||
this.restoreOverflow = false;
|
||||
}
|
||||
this._shown = false;
|
||||
this.$element.removeClass('shown');
|
||||
this.element.classList.remove('shown');
|
||||
|
||||
this.$timeout.cancel(this.showTimeout);
|
||||
this.showTimeout = this.$timeout(() => {
|
||||
this.element.style.display = 'none';
|
||||
this.showTimeout = null;
|
||||
this.element.style.display = 'none';
|
||||
this.document.body.removeChild(this.element);
|
||||
this.emit('close');
|
||||
}, 250);
|
||||
|
||||
this.document.removeEventListener('keydown', this.docKeyDownHandler);
|
||||
this.document.removeEventListener('focusin', this.docFocusInHandler);
|
||||
this.docKeyDownHandler = null;
|
||||
|
||||
this.element.removeEventListener('mousedown', this.bgMouseDownHandler);
|
||||
this.bgMouseDownHandler = null;
|
||||
|
||||
if (this.deregisterCallback)
|
||||
this.deregisterCallback();
|
||||
|
@ -165,7 +146,7 @@ export default class Popover extends Component {
|
|||
let arrowHeight = Math.floor(arrowRect.height / 2);
|
||||
let arrowOffset = arrowHeight + margin / 2;
|
||||
|
||||
let docEl = document.documentElement;
|
||||
let docEl = this.document.documentElement;
|
||||
let maxRight = Math.min(window.innerWidth, docEl.clientWidth) - margin;
|
||||
let maxBottom = Math.min(window.innerHeight, docEl.clientHeight) - margin;
|
||||
let maxWith = maxRight - margin;
|
||||
|
@ -214,20 +195,10 @@ export default class Popover extends Component {
|
|||
if (event != this.lastMouseEvent)
|
||||
this.hide();
|
||||
}
|
||||
|
||||
onFocusIn(event) {
|
||||
this.lastFocusEvent = event;
|
||||
}
|
||||
|
||||
onDocFocusIn(event) {
|
||||
if (event !== this.lastFocusEvent)
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
Popover.$inject = ['$element', '$scope', '$timeout', '$transitions'];
|
||||
Popover.$inject = ['$element', '$scope', '$timeout', '$transitions', '$transclude', '$compile'];
|
||||
|
||||
ngModule.component('vnPopover', {
|
||||
template: require('./popover.html'),
|
||||
controller: Popover,
|
||||
transclude: true
|
||||
});
|
||||
|
|
|
@ -41,10 +41,8 @@ export default class Textfield extends Input {
|
|||
set value(value) {
|
||||
this._value = (value === undefined || value === '') ? null : value;
|
||||
this.input.value = this._value;
|
||||
this.hasValue = this._value !== null;
|
||||
|
||||
if (this.hasValue) this.element.classList.add('not-empty');
|
||||
else this.element.classList.remove('not-empty');
|
||||
this.hasValue = this._value != null;
|
||||
this.element.classList.toggle('not-empty', this.hasValue);
|
||||
}
|
||||
|
||||
get value() {
|
||||
|
|
|
@ -12,15 +12,14 @@ export function directive() {
|
|||
restrict: 'A',
|
||||
link: function($scope, $element, $attrs) {
|
||||
let id = kebabToCamel($attrs.vnId);
|
||||
let controller = $element[0].$ctrl ?
|
||||
$element[0].$ctrl : $element.controller($element[0].tagName.toLowerCase());
|
||||
let $ctrl = $element[0].$ctrl
|
||||
? $element[0].$ctrl
|
||||
: $element.controller($element[0].tagName.toLowerCase());
|
||||
|
||||
if (!id)
|
||||
throw new Error(`vnId: Attribute can't be null`);
|
||||
if (!controller)
|
||||
throw new Error(`vnId: Can't find controller for element '${id}'`);
|
||||
|
||||
$scope[id] = controller;
|
||||
$scope[id] = $ctrl || $element[0];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -25,14 +25,6 @@ describe('Directive vnId', () => {
|
|||
}).toThrow(new Error(`vnId: Attribute can't be null`));
|
||||
});
|
||||
|
||||
it(`should throw an error when these's no controller defined in $element[0]`, () => {
|
||||
let html = `<div vn-id="1"></div>`;
|
||||
|
||||
expect(() => {
|
||||
compile(html);
|
||||
}).toThrow(new Error(`vnId: Can't find controller for element '1'`));
|
||||
});
|
||||
|
||||
// FIXME: Sometimes fails with '$scope is undefined'
|
||||
xit(`should set the controller into the $scope as there are no errors being thrown`, () => {
|
||||
let html = `<form vn-id="1"></form>`;
|
||||
|
|
|
@ -8,22 +8,101 @@ export default class Input extends Component {
|
|||
super($element, $scope);
|
||||
this.input = this.element.querySelector('input');
|
||||
}
|
||||
|
||||
set disabled(value) {
|
||||
this.input.disabled = value == true;
|
||||
this.mdlUpdate();
|
||||
}
|
||||
|
||||
get disabled() {
|
||||
return this.input.disabled;
|
||||
}
|
||||
|
||||
select() {
|
||||
this.input.select();
|
||||
}
|
||||
|
||||
focus() {
|
||||
this.input.focus();
|
||||
}
|
||||
|
||||
mdlUpdate() {
|
||||
if (this.mdlElement)
|
||||
this.mdlElement.updateClasses_();
|
||||
}
|
||||
|
||||
get validationError() {
|
||||
return this.input.validationMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a valid input value
|
||||
*
|
||||
* @return {Boolean} - True if has a valid value
|
||||
*/
|
||||
hasValidValue() {
|
||||
return this.input.checkValidity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the input element
|
||||
* if has a validation error
|
||||
*/
|
||||
validateValue() {
|
||||
if (!this.hasValidValue()) {
|
||||
this.hideError();
|
||||
this.showError();
|
||||
} else
|
||||
this.hideError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the input validation error
|
||||
*/
|
||||
showError() {
|
||||
const infixElement = this.element.querySelector('.infix');
|
||||
const infixClassList = infixElement.classList;
|
||||
|
||||
const errorSpan = document.createElement('span');
|
||||
errorSpan.className = 'mdl-textfield__error';
|
||||
|
||||
const errorText = document.createTextNode(this.validationError);
|
||||
|
||||
errorSpan.append(errorText);
|
||||
infixElement.append(errorSpan);
|
||||
|
||||
infixClassList.add('validated', 'invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the input validation error
|
||||
*/
|
||||
hideError() {
|
||||
const infixElement = this.element.querySelector('.infix');
|
||||
const infixClassList = infixElement.classList;
|
||||
const errorElement = this.element.querySelector('.infix span.mdl-textfield__error');
|
||||
|
||||
if (errorElement)
|
||||
errorElement.remove();
|
||||
|
||||
infixClassList.remove('validated', 'invalid');
|
||||
}
|
||||
}
|
||||
Input.$inject = ['$element', '$scope'];
|
||||
|
||||
export const component = {
|
||||
transclude: {
|
||||
leftIcons: '?tLeftIcons',
|
||||
rightIcons: '?tRightIcons'
|
||||
},
|
||||
bindings: {
|
||||
label: '@?',
|
||||
disabled: '<?',
|
||||
readonly: '<?',
|
||||
rule: '@?',
|
||||
value: '=model',
|
||||
vnTabIndex: '@?',
|
||||
onChange: '&',
|
||||
onClear: '&'
|
||||
}
|
||||
};
|
||||
|
|
|
@ -7,8 +7,10 @@ import 'angular-translate-loader-partial';
|
|||
import '@uirouter/angularjs';
|
||||
import 'mg-crud';
|
||||
import 'oclazyload';
|
||||
/*
|
||||
import 'angular-material';
|
||||
import 'angular-material/modules/scss/angular-material.scss';
|
||||
*/
|
||||
import 'angular-moment';
|
||||
|
||||
export const ngDeps = [
|
||||
|
@ -16,7 +18,7 @@ export const ngDeps = [
|
|||
'ui.router',
|
||||
'mgCrud',
|
||||
'oc.lazyLoad',
|
||||
'ngMaterial',
|
||||
// 'ngMaterial',
|
||||
'angularMoment'
|
||||
];
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</vn-icon-button>
|
||||
</div>
|
||||
<vn-menu vn-id="apps-menu">
|
||||
<ul pad-small>
|
||||
<ul pad-small class="modules-menu">
|
||||
<li ng-repeat="mod in ::$ctrl.modules" ui-sref="{{::mod.route.state}}">
|
||||
<vn-icon icon="{{::mod.icon || 'photo'}}"></vn-icon>
|
||||
<span translate>{{::mod.name}}</span>
|
||||
|
|
|
@ -26,28 +26,29 @@ vn-main-menu {
|
|||
padding: 0;
|
||||
margin-left: .3em;
|
||||
}
|
||||
}
|
||||
vn-menu.vn-popover > div > div.content > ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
color: $color-font-dark;
|
||||
|
||||
& > li {
|
||||
@extend %clickable-light;
|
||||
background-color: $color-main;
|
||||
margin-bottom: .6em;
|
||||
padding: .8em;
|
||||
border-radius: .1em;
|
||||
min-width: 8em;
|
||||
white-space: nowrap;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
& > vn-icon {
|
||||
padding-right: .3em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.vn-popover .modules-menu {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
color: $color-font-dark;
|
||||
|
||||
& > li {
|
||||
@extend %clickable-light;
|
||||
background-color: $color-main;
|
||||
margin-bottom: .6em;
|
||||
padding: .8em;
|
||||
border-radius: .1em;
|
||||
min-width: 8em;
|
||||
white-space: nowrap;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
& > vn-icon {
|
||||
padding-right: .3em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
order="code">
|
||||
</vn-crud-model>
|
||||
<vn-popover vn-id="popover">
|
||||
<vn-vertical class="body">
|
||||
<vn-vertical class="user-configuration">
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
label="Local warehouse"
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
@import "variables";
|
||||
|
||||
vn-user-configuration-popover {
|
||||
vn-popover {
|
||||
color: $color-font;
|
||||
vn-vertical {
|
||||
min-width: 250px;
|
||||
}
|
||||
.body {
|
||||
padding: 16px 16px 6px 16px;
|
||||
}
|
||||
}
|
||||
.vn-popover .user-configuration {
|
||||
min-width: 250px;
|
||||
padding: $pad-medium;
|
||||
}
|
|
@ -56,5 +56,6 @@
|
|||
"You can't delete a confirmed order": "You can't delete a confirmed order",
|
||||
"Value has an invalid format": "Value has an invalid format",
|
||||
"The postcode doesn't exists. Ensure you put the correct format": "The postcode doesn't exists. Ensure you put the correct format",
|
||||
"Can't create stowaway for this ticket": "Can't create stowaway for this ticket"
|
||||
"Can't create stowaway for this ticket": "Can't create stowaway for this ticket",
|
||||
"is not a valid date": "is not a valid date"
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
import '../index.js';
|
||||
import watcher from 'core/mocks/watcher';
|
||||
|
||||
fdescribe('Ticket', () => {
|
||||
describe('Ticket', () => {
|
||||
describe('Component vnTicketSale', () => {
|
||||
let controller;
|
||||
let $scope;
|
||||
|
|
|
@ -236,6 +236,7 @@ class Controller {
|
|||
|
||||
addTime(response) {
|
||||
if (response === 'ACCEPT') {
|
||||
console.log('newTime', this.newTime);
|
||||
let data = {workerFk: this.worker.id, timed: this.newTime};
|
||||
let query = `/api/WorkerTimeControls/addTime`;
|
||||
this.$http.post(query, data).then(() => {
|
||||
|
|
Loading…
Reference in New Issue