Skip to content
Snippets Groups Projects
Commit 4ff62d2d authored by mathias.chouet's avatar mathias.chouet
Browse files

Fix #231 - input value update on model change

parent e5af0e56
No related branches found
No related tags found
No related merge requests found
import { AppPage } from "./app.po";
import { ListPage } from "./list.po";
import { CalculatorPage } from "./calculator.po";
import { Navbar } from "./navbar.po";
import { SideNav } from "./sidenav.po";
import { browser, by } from "protractor";
describe("Lechapt-Calmon", () => {
let listPage: ListPage;
let calcPage: CalculatorPage;
let navBar: Navbar;
let startPage: AppPage;
let sidenav: SideNav;
beforeEach(() => {
listPage = new ListPage();
calcPage = new CalculatorPage();
navBar = new Navbar();
startPage = new AppPage();
sidenav = new SideNav();
});
it(" − material selector should modify input values", async () => {
// create a Lechapt-Calmon
await startPage.navigateTo();
await listPage.clickMenuEntryForCalcType(1);
const L = calcPage.getInputById("L");
const M = calcPage.getInputById("M");
const N = calcPage.getInputById("N");
// check default values for L, M, N
expect(await L.getAttribute("value")).toBe("1.863");
expect(await M.getAttribute("value")).toBe("2");
expect(await N.getAttribute("value")).toBe("5.33");
// change material
const selectMaterial = calcPage.getSelectById("select_material");
await calcPage.changeSelectValue(selectMaterial, 4);
// check default values for L, M, N
expect(await L.getAttribute("value")).toBe("1.16");
expect(await M.getAttribute("value")).toBe("1.93");
expect(await N.getAttribute("value")).toBe("5.11");
});
});
......@@ -308,11 +308,17 @@ export class NgParameter extends InputField implements Observer {
* notification envoyée après la modification de la valeur du paramètre
*/
private notifyValueModified(sender: any) {
let val: number;
if (this._paramDef.valueMode === ParamValueMode.SINGLE) {
val = this._paramDef.singleValue;
} else {
val = this._paramDef.v; // @WARNING coward retrocompat
}
this.notifyObservers(
{
"action": "ngparamAfterValue",
"param": this,
"value": this._paramDef.v
"value": val
}, sender
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment