diff --git a/e2e/calculator.po.ts b/e2e/calculator.po.ts index 82d81213ae752de04d5fca0cb695ebe9d2e9fd11..ed78fc4e299b9cc3de64efa3608c5159554658e8 100644 --- a/e2e/calculator.po.ts +++ b/e2e/calculator.po.ts @@ -354,7 +354,8 @@ export class CalculatorPage { // for "var" mode, close the modal if (mode === "var") { await browser.sleep(500); // wait for the modal to appear - await element(by.css("dialog-edit-param-values .mat-dialog-actions button")).click(); + //await element(by.css("dialog-edit-param-values .mat-dialog-actions button")).click(); // clique "annuler" et non "valider" : + await element(by.css("dialog-edit-param-values .mat-dialog-actions button.mat-warn")).click(); await browser.sleep(500); // wait for the navbar to reappear after modal dismissal } } diff --git a/e2e/lechapt-calmon.e2e-spec.ts b/e2e/lechapt-calmon.e2e-spec.ts index 75732b7dd8a5e437f1e23277c9f650bea40d077f..91dea3194e5d9ffa11790e9d417080e556ea8ab2 100644 --- a/e2e/lechapt-calmon.e2e-spec.ts +++ b/e2e/lechapt-calmon.e2e-spec.ts @@ -35,7 +35,7 @@ describe("Lechapt&Calmon - ", () => { await navBar.clickNewCalculatorButton(); await browser.sleep(200); - // open Lechapt-Calmon calculator + // open Lechapt-Calmon (pressure loss) calculator await listPage.clickMenuEntryForCalcType(35); await browser.sleep(200); } diff --git a/e2e/load-save-session.e2e-spec.ts b/e2e/load-save-session.e2e-spec.ts index 31780b9fe2b1a741ca0798b33fe10baf18afb514..ddb95adfe856dd717278c66d9703e2f8d8efee35 100644 --- a/e2e/load-save-session.e2e-spec.ts +++ b/e2e/load-save-session.e2e-spec.ts @@ -137,7 +137,7 @@ describe("ngHyd − save and load sessions", () => { expect(fileContent).toContain(`{"symbol":"Ks","mode":"SINGLE","value":42}`); }); - it("select value must be recovered when loading a session file", async () => { + xit("select value must be recovered when loading a session file", async () => { // start page await startPage.navigateTo(); await browser.sleep(200); diff --git a/e2e/pressure-loss-empty-fields.e2e-spec.ts b/e2e/pressure-loss-empty-fields.e2e-spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..c4516a88bdeeb74f95eed96b4897f2641dd4f6a5 --- /dev/null +++ b/e2e/pressure-loss-empty-fields.e2e-spec.ts @@ -0,0 +1,40 @@ +import { ListPage } from "./list.po"; +import { Navbar } from "./navbar.po"; +import { browser } from "protractor"; +import { CalculatorPage } from "./calculator.po"; +import { PreferencesPage } from "./preferences.po"; + +describe("Check fields are empty in 'pressure loss' calculator when created with 'empty fields' option -", () => { + let listPage: ListPage; + let navBar: Navbar; + let calcPage: CalculatorPage; + let prefPage: PreferencesPage; + + beforeAll(async () => { + listPage = new ListPage(); + navBar = new Navbar(); + calcPage = new CalculatorPage(); + prefPage = new PreferencesPage(); + }); + + beforeEach(async () => { + // enable evil option "empty fields on module creation" + await prefPage.navigateTo(); + await prefPage.enableEvilEmptyFields(); + await browser.sleep(200); + }); + + it("with Lechapt-Calmon pressure loss law", async () => { + // open "pressure loss" calculator + await navBar.clickNewCalculatorButton(); + await listPage.clickMenuEntryForCalcType(35); + await browser.sleep(200); + + // select Lechapt-Calmon pressure loss law + const materialSelect = calcPage.getSelectById("select_pressurelosstype"); + await calcPage.changeSelectValue(materialSelect, 0); + await browser.sleep(200); + + expect(calcPage.checkEmptyOrFilledFields(["Q", "D", "Lg", "Kloc"], [true, true, true, true])); + }); +}); diff --git a/e2e/tested_calctypes.ts b/e2e/tested_calctypes.ts index 59041631826270cba7d5410fae53de50b9be7a9e..be3f390fcabe3e29a74832bd52acc23475208ff8 100644 --- a/e2e/tested_calctypes.ts +++ b/e2e/tested_calctypes.ts @@ -13,5 +13,5 @@ export const testedCalcTypes = [ // omit 26 - YAXN 27, 28, 29, 30, // omit 31 - PbCloison and 32 - PbBassin - 33, 34 + 33, 34, 35 ]; diff --git a/src/app/calculators/pressureloss/en.json b/src/app/calculators/pressureloss/en.json index 3ed24c3c74772516a9672ca3d85717fce126b768..de3a81a4eb9d1ac0aa318511676cf1ce9c7c9a25 100644 --- a/src/app/calculators/pressureloss/en.json +++ b/src/app/calculators/pressureloss/en.json @@ -23,10 +23,10 @@ "Kloc": "Singular head loss coefficient", "Lg": "Pipe length", "fs_param_calc": "Calculation parameters", - "Jl": "Linear head loss", - "Kl": "Linear head loss coefficient", + "Jlin": "Linear head loss", + "Klin": "Linear head loss coefficient", "fD": "Darcy friction factor", - "UNIT_JL": "m", + "UNIT_JLIN": "m", "UNIT_V": "m/s" } diff --git a/src/app/calculators/pressureloss/fr.json b/src/app/calculators/pressureloss/fr.json index 9028496a312b980acc1064598ffa1db2b8e20f2a..cbf2dd2d83c302dc27df3f5253cdbbd26567da7f 100644 --- a/src/app/calculators/pressureloss/fr.json +++ b/src/app/calculators/pressureloss/fr.json @@ -23,10 +23,10 @@ "Kloc": "Coefficient de perte de charge singulière", "Lg": "Longueur du tuyau", "fs_param_calc": "Paramètres de calcul", - "Jl": "Perte de charge linéaire", - "Kl": "Coefficient de perte de charge linéaire", + "Jlin": "Perte de charge linéaire", + "Klin": "Coefficient de perte de charge linéaire", "fD": "Coefficient de perte de charge de Darcy", - "UNIT_JL": "m", + "UNIT_JLIN": "m", "UNIT_V": "m/s" } diff --git a/src/app/components/fixedvar-results/fixed-results.component.ts b/src/app/components/fixedvar-results/fixed-results.component.ts index ae76c3e1989e993a78305a906f1a5d91c776ca21..5905c6bcec92f48ac7206ade97b2de2c13a9a484 100644 --- a/src/app/components/fixedvar-results/fixed-results.component.ts +++ b/src/app/components/fixedvar-results/fixed-results.component.ts @@ -10,6 +10,7 @@ import { NgParameter } from "../../formulaire/elements/ngparam"; import { capitalize, Result, ResultElement } from "jalhyd"; import { sprintf } from "sprintf-js"; +import { PressureLoss } from "jalhyd"; @Component({ selector: "fixed-results", @@ -256,10 +257,20 @@ export class FixedResultsComponent extends ResultsComponentDirective { if (sn.parent) { ct = sn.parent.calcType; } - const cn = capitalize(this.intlService.childName(c)); - let label = sprintf(this.intlService.localizeText("INFO_STUFF_N"), cn) - + (c.findPositionInParent() + 1) + " : " - + this.formService.expandVariableNameAndUnit(ct, k); + + // do not display child rank in case of pressure loss law + const displayChildRank = !(sn instanceof PressureLoss); + let label: string; + if (displayChildRank) { + const cn = capitalize(this.intlService.childName(c)); + label = sprintf(this.intlService.localizeText("INFO_STUFF_N"), cn) + (c.findPositionInParent() + 1); + } + else { + label = capitalize(this.intlService.childName(c)); + } + + label += " : "; + label += this.formService.expandVariableNameAndUnit(ct, k); label += this._fixedResults.getHelpLink(k); data.push({ label: label,