-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed issue edit pattern not applied #1030
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,15 +178,17 @@ describe("Form Runtime with Date Picker", () => { | |
}); | ||
|
||
// choose a different date and check if its persisted | ||
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible").click().then(() => { | ||
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible") | ||
.eq(0).click({force: true}).then(() => { | ||
cy.get("#li-day-3").should("be.visible").click(); // clicking on the 2nd day of the month of October 2023 | ||
cy.get(`#${datePicker7}`).find("input").blur().should("have.value","Wednesday, 2 August, 2023"); | ||
cy.get(`#${datePicker7}`).find("input").focus().should("have.value","2/8/2023"); | ||
|
||
}); | ||
|
||
// check clear option | ||
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible").click().then(() => { | ||
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible") | ||
.eq(0).click({force: true}).then(() => { | ||
cy.get(".dp-clear").click(); | ||
}); | ||
|
||
|
@@ -195,7 +197,8 @@ describe("Form Runtime with Date Picker", () => { | |
|
||
it("Test order of the days", () => { | ||
const [datePicker7, datePicker7FieldView] = Object.entries(formContainer._fields)[6]; | ||
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible").click().then(() => { | ||
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible") | ||
.eq(0).click({force: true}).then(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why have you changed the existing test suite ? Isn't this a breaking change ? Ideally with your changes, you only need to add a new test spec. Please remove the changes to the existing test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some tests were failing because all the calendar icons are on top right of the page and overlapping each other. |
||
cy.get(".header").invoke("text").should("eq", 'SunMonTueWedThuFriSat'); | ||
}); | ||
}); | ||
|
@@ -221,4 +224,47 @@ describe("Form Runtime with Date Picker", () => { | |
}); | ||
}); | ||
|
||
it("input given as per edit pattern should be valid", () => { | ||
const [datePicker8] = Object.entries(formContainer._fields)[7] | ||
const incorrectInput = "01-01-2023"; | ||
const correctInput = "25/2/2023"; | ||
cy.get(`#${datePicker8}`).find("input").clear().type(incorrectInput).blur().then(x => { | ||
cy.get(`#${datePicker8}`).find(".cmp-adaptiveform-datepicker__errormessage").should('have.text',"Specify the value in allowed format : date.") | ||
}); | ||
cy.get(`#${datePicker8}`).find("input").clear().type(correctInput).blur().then(x => { | ||
cy.get(`#${datePicker8}`).find(".cmp-adaptiveform-datepicker__errormessage").should('have.text',""); | ||
}); | ||
}); | ||
|
||
it("Display pattern transforms to edit format when focused", () => { | ||
const [datePicker8, fieldView] = Object.entries(formContainer._fields)[7] | ||
const input = "25/2/2023", displayFormat = "February 25, 2023"; | ||
cy.get(`#${datePicker8}`).should('have.class', 'cmp-adaptiveform-datepicker--empty'); | ||
cy.get(`#${datePicker8}`).find("input").clear().type(input).blur().then(() => { | ||
cy.get(`#${datePicker8}`).find(".cmp-adaptiveform-datepicker__errormessage").should('have.text',""); | ||
cy.get(`#${datePicker8}`).find("input").should('have.value', displayFormat); | ||
cy.get(`#${datePicker8}`).find("input").click().then(() => { | ||
cy.get(`#${datePicker8}`).find("input").should('have.value',input); | ||
}) | ||
}); | ||
}); | ||
|
||
it("Test changing dates in datePicker then typing manually updates model", () => { | ||
const [datePicker7] = Object.entries(formContainer._fields)[6]; | ||
|
||
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon").should("be.visible") | ||
.eq(0).click({force: true}).then(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No use of force:true on runtime test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. force true is used because the calendar icons are overlapping each other because the test collaterals do not have css |
||
cy.get("#li-day-3").should("be.visible").click(); // clicking on the 2nd day of the month of October 2023 | ||
cy.get(`#${datePicker7}`).find("input").blur().should("have.value","Tuesday, 2 January, 2024"); | ||
cy.get(`#${datePicker7}`).find("input").focus().should("have.value","2/1/2024"); | ||
}); | ||
|
||
// choose a different date and check if its persisted | ||
const date = '23/1/2024'; | ||
cy.get(`#${datePicker7}`).find("input").clear().type(date).then(() => { | ||
cy.get(`#${datePicker7}`).find("input").blur().should("have.value", "Tuesday, 23 January, 2024"); | ||
cy.get(`#${datePicker7}`).find("input").focus().should("have.value",date); | ||
}); | ||
}); | ||
|
||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, you are basically trying to get the data value which is in ISO format from a formatted value. We should have a function for this in af-core and direcly use it, rather than copying the entire logic of formatters here ? @vdua IIRC, we do have some utility for this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet, but I asked @egmox to create it in runtime. I would suggest making editValue writable property and set this._model.editValue = user entered value
and the setter should parse it accordingly.