From e0924ea373a4b72bf5a6338740500bcd11957259 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 15 Mar 2022 15:18:27 +0100 Subject: [PATCH 1/6] refactor(item_fixed-price): add checkbox hasMinPrice, tooltips, more witdh --- modules/item/front/fixed-price/index.html | 45 ++++++++++++++------ modules/item/front/fixed-price/locale/es.yml | 4 +- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/modules/item/front/fixed-price/index.html b/modules/item/front/fixed-price/index.html index 6f98ba65b..34d63ffe2 100644 --- a/modules/item/front/fixed-price/index.html +++ b/modules/item/front/fixed-price/index.html @@ -22,16 +22,27 @@ model="model"> -
+
Item ID Description - Warehouse - P.P.U. - P.P.P. + Warehouse + + P.P.U. + + + P.P.P. + + Min price Started Ended @@ -41,12 +52,7 @@ - - {{price.itemFk}} - + {{price.itemFk}}
- {{price.name}} + + {{price.name}} +

{{price.subName}}

@@ -77,7 +89,7 @@ tabindex="-1"> - + + + + + - {{(price.hasMinPrice ? (price.minPrice | currency: 'EUR':2) : "-")}} + {{price.minPrice | currency: 'EUR':2}} Date: Wed, 16 Mar 2022 14:58:07 +0100 Subject: [PATCH 2/6] feat(item_fixed-price): implement smart-table --- front/core/components/smart-table/table.scss | 4 + modules/item/front/fixed-price/index.html | 312 +++++++++---------- modules/item/front/fixed-price/index.js | 31 +- modules/item/front/fixed-price/index.spec.js | 15 + modules/item/front/fixed-price/style.scss | 5 - 5 files changed, 202 insertions(+), 165 deletions(-) diff --git a/front/core/components/smart-table/table.scss b/front/core/components/smart-table/table.scss index c38c149ca..95d8efb49 100644 --- a/front/core/components/smart-table/table.scss +++ b/front/core/components/smart-table/table.scss @@ -37,6 +37,10 @@ smart-table table { &[centered] { text-align: center; } + &[mid] { + width: 150px; + max-width: 150px; + } &[shrink] { width: 1px; text-align: center; diff --git a/modules/item/front/fixed-price/index.html b/modules/item/front/fixed-price/index.html index 34d63ffe2..d531774a0 100644 --- a/modules/item/front/fixed-price/index.html +++ b/modules/item/front/fixed-price/index.html @@ -3,8 +3,8 @@ url="FixedPrices/filter" limit="20" data="prices" - auto-load="true" - order="itemFk"> + order="itemFk" + auto-load="false">
- - - - Item ID - Description - Warehouse - - P.P.U. - - - P.P.P. - - - Min price - Started - Ended - - - - - - - {{price.itemFk}} - - - {{::id}} - {{::name}} - - - - -
- - {{price.name}} - - -

{{price.subName}}

-
-
- - -
- - - - - - {{price.rate2 | currency: 'EUR':2}} - - - - - - - {{price.rate3 | currency: 'EUR':2}} - - - - - - - - - - - {{price.minPrice | currency: 'EUR':2}} - - - - - - - - - - - - - - - - - -
-
-
-
- - -
- - + options="$ctrl.smartTableOptions" + expr-builder="$ctrl.exprBuilder(param, value)"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Item ID + + Description + + Warehouse + + P.P.U. + + P.P.P. + + Min price + + Started + + Ended +
+ + + {{::id}} + + + +
+ + {{price.name}} + + +

{{price.subName}}

+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ + +
+
{ controller = $componentController('vnFixedPrice', {$element, $scope}); })); + describe('$onInit()', () => { + it('should perform a query to GET warehouses', () => { + $httpBackend.expectGET('Warehouses').respond('foo'); + + controller.$onInit(); + $httpBackend.flush(); + + expect(controller.warehousesData).toBe('foo'); + }); + }); + describe('upsertPrice()', () => { it('should do nothing if one or more required arguments are missing', () => { jest.spyOn(controller.vnApp, 'showSuccess'); @@ -55,6 +66,10 @@ describe('fixed price', () => { jest.spyOn(controller.vnApp, 'showSuccess'); jest.spyOn(controller.$.model, 'remove'); + // $httpBackend.whenRoute('GET', 'Warehouses').respond(); + // $httpBackend.when('GET', 'Warehouses').respond(); + $httpBackend.expectGET('Warehouses').respond(); + controller.removePrice($index); expect(controller.vnApp.showSuccess).not.toHaveBeenCalled(); diff --git a/modules/item/front/fixed-price/style.scss b/modules/item/front/fixed-price/style.scss index 74df1800a..e69de29bb 100644 --- a/modules/item/front/fixed-price/style.scss +++ b/modules/item/front/fixed-price/style.scss @@ -1,5 +0,0 @@ -@import "variables"; - -vn-table vn-date-picker { - max-width: 90px; -} \ No newline at end of file From e8b4896e98600f54123438ef0229395d0fce7e55 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 17 Mar 2022 09:13:09 +0100 Subject: [PATCH 3/6] feat(item_fixed-price): add search, and defaultSerach --- modules/item/front/fixed-price/index.html | 25 +++++------ modules/item/front/fixed-price/index.js | 45 +++++++++++++++++++- modules/item/front/fixed-price/index.spec.js | 11 ----- modules/item/front/fixed-price/style.scss | 14 ++++++ 4 files changed, 68 insertions(+), 27 deletions(-) diff --git a/modules/item/front/fixed-price/index.html b/modules/item/front/fixed-price/index.html index d531774a0..2e0c33be9 100644 --- a/modules/item/front/fixed-price/index.html +++ b/modules/item/front/fixed-price/index.html @@ -34,7 +34,7 @@ Item ID - + Description @@ -64,7 +64,7 @@ - + - + - - - - - + + + - + - + @@ -139,7 +136,6 @@ @@ -147,7 +143,6 @@ diff --git a/modules/item/front/fixed-price/index.js b/modules/item/front/fixed-price/index.js index 39d965217..95424694d 100644 --- a/modules/item/front/fixed-price/index.js +++ b/modules/item/front/fixed-price/index.js @@ -9,7 +9,34 @@ export default class Controller extends Section { this.smartTableOptions = { activeButtons: { search: true - } + }, + defaultSearch: true, + columns: [ + { + field: 'itemName', + autocomplete: { + url: 'Items', + showField: 'name', + valueField: 'id' + } + }, + { + field: 'warehouseFk', + autocomplete: { + url: 'Warehouses', + showField: 'name', + valueField: 'id', + } + }, + { + field: 'started', + searchable: false + }, + { + field: 'ended', + searchable: false + } + ] }; } @@ -69,6 +96,22 @@ export default class Controller extends Section { ? {id: $search} : {name: {like: '%' + $search + '%'}}; } + + exprBuilder(param, value) { + switch (param) { + case 'itemName': + return {'i.id': value}; + case 'itemFk': + case 'warehouseFk': + case 'rate2': + case 'rate3': + param = `fp.${param}`; + return {[param]: value}; + case 'minPrice': + param = `i.${param}`; + return {[param]: value}; + } + } } ngModule.vnComponent('vnFixedPrice', { diff --git a/modules/item/front/fixed-price/index.spec.js b/modules/item/front/fixed-price/index.spec.js index 70bf0b387..2e09bab77 100644 --- a/modules/item/front/fixed-price/index.spec.js +++ b/modules/item/front/fixed-price/index.spec.js @@ -14,17 +14,6 @@ describe('fixed price', () => { controller = $componentController('vnFixedPrice', {$element, $scope}); })); - describe('$onInit()', () => { - it('should perform a query to GET warehouses', () => { - $httpBackend.expectGET('Warehouses').respond('foo'); - - controller.$onInit(); - $httpBackend.flush(); - - expect(controller.warehousesData).toBe('foo'); - }); - }); - describe('upsertPrice()', () => { it('should do nothing if one or more required arguments are missing', () => { jest.spyOn(controller.vnApp, 'showSuccess'); diff --git a/modules/item/front/fixed-price/style.scss b/modules/item/front/fixed-price/style.scss index e69de29bb..e35286cae 100644 --- a/modules/item/front/fixed-price/style.scss +++ b/modules/item/front/fixed-price/style.scss @@ -0,0 +1,14 @@ +@import "variables"; + +vn-autocomplete { + max-width: 150px; +} +vn-input-number { + max-width: 80px; +} + +.minPrice { + display: inline-flex; + align-items: center; + justify-content: center; +} \ No newline at end of file From 7bd74d6b3b46ea6d58b5acde70a0638b3a56cd61 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 17 Mar 2022 09:14:01 +0100 Subject: [PATCH 4/6] feat(smart-table): add defaultSearch option --- front/core/components/smart-table/index.js | 3 +++ front/core/components/smart-table/table.scss | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/front/core/components/smart-table/index.js b/front/core/components/smart-table/index.js index b0b4d90dc..84c963e8e 100644 --- a/front/core/components/smart-table/index.js +++ b/front/core/components/smart-table/index.js @@ -32,6 +32,9 @@ export default class SmartTable extends Component { this._options = options; if (!options) return; + if (options.defaultSearch) + this.displaySearch(); + const activeButtons = options.activeButtons; const missingId = activeButtons && activeButtons.shownColumns && !this.viewConfigId; if (missingId) diff --git a/front/core/components/smart-table/table.scss b/front/core/components/smart-table/table.scss index 95d8efb49..c38c149ca 100644 --- a/front/core/components/smart-table/table.scss +++ b/front/core/components/smart-table/table.scss @@ -37,10 +37,6 @@ smart-table table { &[centered] { text-align: center; } - &[mid] { - width: 150px; - max-width: 150px; - } &[shrink] { width: 1px; text-align: center; From b56e1810c373af98ce8e8f1854c7cd5b3745a4b6 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 18 Mar 2022 10:30:30 +0100 Subject: [PATCH 5/6] test(item_fixedPrice): fix back test & e2e --- db/dump/fixtures.sql | 38 +++++++++---------- e2e/helpers/selectors.js | 21 +++++----- e2e/paths/04-item/13_fixedPrice.spec.js | 28 ++++---------- .../methods/fixed-price/specs/filter.spec.js | 4 +- modules/item/front/fixed-price/index.html | 25 +++++++----- modules/item/front/fixed-price/index.js | 8 +++- modules/item/front/fixed-price/style.scss | 22 +++++++---- 7 files changed, 75 insertions(+), 71 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 6f7cc87e5..1475635f7 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -807,25 +807,25 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`) ('VT', 'Sales'); INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`, - `comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`) + `comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`) VALUES - (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL, 'V'), - (2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H'), - (3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL), - (4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL), - (5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL), - (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL), - (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL), - (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL), - (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL), - (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL), - (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL), - (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL), - (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 0, 2, 'VT', 1, NULL, NULL), - (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL), - (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL), - (16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL), - (71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL); + (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL, 'V', 0), + (2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H', 0), + (3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL, 0), + (4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0), + (5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0), + (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0), + (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0), + (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0), + (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0), + (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0), + (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0), + (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0), + (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1), + (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0), + (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0), + (16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0), + (71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0); -- Update the taxClass after insert of the items UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2 @@ -835,7 +835,7 @@ INSERT INTO `vn`.`priceFixed`(`id`, `itemFk`, `rate0`, `rate1`, `rate2`, `rate3` VALUES (1, 1, 0, 0, 2.5, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 0, 1, CURDATE()), (2, 3, 10, 10, 10, 10, CURDATE(), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 0, 1, CURDATE()), - (3, 5, 8.5, 10, 7.5, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 1, 2, CURDATE()); + (3, 13, 8.5, 10, 7.5, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 1, 2, CURDATE()); INSERT INTO `vn`.`expeditionBoxVol`(`boxFk`, `m3`, `ratio`) VALUES diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index d5b075e13..5c896d678 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -346,16 +346,17 @@ export default { saveFieldsButton: '.vn-popover.shown vn-button[label="Save"] > button' }, itemFixedPrice: { - add: 'vn-fixed-price vn-icon[icon="add_circle"]', - fourthFixedPrice: 'vn-fixed-price vn-tr:nth-child(4)', - fourthItemID: 'vn-fixed-price vn-tr:nth-child(4) vn-autocomplete[ng-model="price.itemFk"]', - fourthWarehouse: 'vn-fixed-price vn-tr:nth-child(4) vn-autocomplete[ng-model="price.warehouseFk"]', - fourthPPU: 'vn-fixed-price vn-tr:nth-child(4) > vn-td-editable:nth-child(4)', - fourthPPP: 'vn-fixed-price vn-tr:nth-child(4) > vn-td-editable:nth-child(5)', - fourthMinPrice: 'vn-fixed-price vn-tr:nth-child(4) > vn-td-editable:nth-child(6)', - fourthStarted: 'vn-fixed-price vn-tr:nth-child(4) vn-date-picker[ng-model="price.started"]', - fourthEnded: 'vn-fixed-price vn-tr:nth-child(4) vn-date-picker[ng-model="price.ended"]', - fourthDeleteIcon: 'vn-fixed-price vn-tr:nth-child(4) > vn-td:nth-child(9) > vn-icon-button[icon="delete"]' + add: 'vn-fixed-price vn-icon-button[icon="add_circle"]', + fourthFixedPrice: 'vn-fixed-price tr:nth-child(5)', + fourthItemID: 'vn-fixed-price tr:nth-child(5) vn-autocomplete[ng-model="price.itemFk"]', + fourthWarehouse: 'vn-fixed-price tr:nth-child(5) vn-autocomplete[ng-model="price.warehouseFk"]', + fourthPPU: 'vn-fixed-price tr:nth-child(5) > td:nth-child(4)', + fourthPPP: 'vn-fixed-price tr:nth-child(5) > td:nth-child(5)', + fourthHasMinPrice: 'vn-fixed-price tr:nth-child(5) > td:nth-child(6) > vn-check[ng-model="price.hasMinPrice"]', + fourthMinPrice: 'vn-fixed-price tr:nth-child(5) > td:nth-child(6) > vn-input-number[ng-model="price.minPrice"]', + fourthStarted: 'vn-fixed-price tr:nth-child(5) vn-date-picker[ng-model="price.started"]', + fourthEnded: 'vn-fixed-price tr:nth-child(5) vn-date-picker[ng-model="price.ended"]', + fourthDeleteIcon: 'vn-fixed-price tr:nth-child(5) > td:nth-child(9) > vn-icon-button[icon="delete"]' }, itemCreateView: { temporalName: 'vn-item-create vn-textfield[ng-model="$ctrl.item.provisionalName"]', diff --git a/e2e/paths/04-item/13_fixedPrice.spec.js b/e2e/paths/04-item/13_fixedPrice.spec.js index d68092904..fc7aac3d0 100644 --- a/e2e/paths/04-item/13_fixedPrice.spec.js +++ b/e2e/paths/04-item/13_fixedPrice.spec.js @@ -16,33 +16,17 @@ describe('Item fixed prices path', () => { }); it('should click on the add new foxed price button', async() => { + await page.doSearch(); await page.waitToClick(selectors.itemFixedPrice.add); await page.waitForSelector(selectors.itemFixedPrice.fourthFixedPrice); }); it('should fill the fixed price data', async() => { const now = new Date(); - const searchValue = 'Chest ammo box'; - await page.waitToClick(selectors.itemFixedPrice.fourthItemID); - await page.write('body > div > div > div.content > div.filter.ng-scope > vn-textfield', searchValue); - try { - await page.waitForFunction(searchValue => { - const element = document.querySelector('li.active'); - if (element) - return element.innerText.toLowerCase().includes(searchValue.toLowerCase()); - }, {}, searchValue); - } catch (error) { - const builtSelector = await page.selectorFormater(selectors.ticketSales.moreMenuState); - const inputValue = await page.evaluate(() => { - return document.querySelector('.vn-drop-down.shown vn-textfield input').value; - }); - throw new Error(`${builtSelector} value is ${inputValue}! ${error}`); - } - await page.keyboard.press('Enter'); await page.autocompleteSearch(selectors.itemFixedPrice.fourthWarehouse, 'Warehouse one'); - await page.writeOnEditableTD(selectors.itemFixedPrice.fourthPPU, '20'); - await page.writeOnEditableTD(selectors.itemFixedPrice.fourthPPP, '10'); - await page.writeOnEditableTD(selectors.itemFixedPrice.fourthMinPrice, '5'); + await page.write(selectors.itemFixedPrice.fourthPPU, '1'); + await page.write(selectors.itemFixedPrice.fourthPPP, '1'); + await page.write(selectors.itemFixedPrice.fourthMinPrice, '1'); await page.pickDate(selectors.itemFixedPrice.fourthStarted, now); await page.pickDate(selectors.itemFixedPrice.fourthEnded, now); const message = await page.waitForSnackbar(); @@ -53,7 +37,9 @@ describe('Item fixed prices path', () => { it('should reload the section and check the created price has the expected ID', async() => { await page.accessToSection('item.index'); await page.accessToSection('item.fixedPrice'); - const result = await page.getProperty('vn-fixed-price > div > vn-card > vn-table > div > vn-tbody > vn-tr:nth-child(4) > vn-td:nth-child(1) > span', 'innerText'); + await page.doSearch(); + + const result = await page.waitToGetProperty(selectors.itemFixedPrice.fourthItemID, 'value'); expect(result).toContain('13'); }); diff --git a/modules/item/back/methods/fixed-price/specs/filter.spec.js b/modules/item/back/methods/fixed-price/specs/filter.spec.js index bdb28efd9..b51184de5 100644 --- a/modules/item/back/methods/fixed-price/specs/filter.spec.js +++ b/modules/item/back/methods/fixed-price/specs/filter.spec.js @@ -90,7 +90,7 @@ describe('fixed price filter()', () => { } }); - it('should return no results filtering by hasMinPrice', async() => { + it('should return 1 result filtering by hasMinPrice', async() => { const tx = await models.FixedPrice.beginTransaction({}); try { @@ -103,7 +103,7 @@ describe('fixed price filter()', () => { }; const result = await models.FixedPrice.filter(ctx, null, options); - expect(result.length).toEqual(0); + expect(result.length).toEqual(1); await tx.rollback(); } catch (e) { diff --git a/modules/item/front/fixed-price/index.html b/modules/item/front/fixed-price/index.html index 2e0c33be9..a62542c4c 100644 --- a/modules/item/front/fixed-price/index.html +++ b/modules/item/front/fixed-price/index.html @@ -64,7 +64,7 @@ - + - {{::id}} +
{{id}}
+
+ {{name}} +
@@ -100,7 +103,7 @@ tabindex="-1"> - + - + + on-change="$ctrl.upsertPrice(price)" + step="0.01"> - + + on-change="$ctrl.upsertPrice(price)" + step="0.01"> - + @@ -133,14 +138,14 @@ step="0.01">
- + - + Date: Wed, 23 Mar 2022 12:26:58 +0100 Subject: [PATCH 6/6] renaming --- modules/item/front/fixed-price/index.js | 4 ++-- modules/item/front/fixed-price/index.spec.js | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/item/front/fixed-price/index.js b/modules/item/front/fixed-price/index.js index 5b807ae0d..b84c2cc2d 100644 --- a/modules/item/front/fixed-price/index.js +++ b/modules/item/front/fixed-price/index.js @@ -48,8 +48,8 @@ export default class Controller extends Section { return; } - const lastId = this.$.model.data.length - 1; - const lastItem = this.$.model.data[lastId]; + const lastIndex = this.$.model.data.length - 1; + const lastItem = this.$.model.data[lastIndex]; this.$.model.insert({ itemFk: lastItem.itemFk, name: lastItem.name, diff --git a/modules/item/front/fixed-price/index.spec.js b/modules/item/front/fixed-price/index.spec.js index 2e09bab77..94621e352 100644 --- a/modules/item/front/fixed-price/index.spec.js +++ b/modules/item/front/fixed-price/index.spec.js @@ -55,8 +55,6 @@ describe('fixed price', () => { jest.spyOn(controller.vnApp, 'showSuccess'); jest.spyOn(controller.$.model, 'remove'); - // $httpBackend.whenRoute('GET', 'Warehouses').respond(); - // $httpBackend.when('GET', 'Warehouses').respond(); $httpBackend.expectGET('Warehouses').respond(); controller.removePrice($index);