-
Notifications
You must be signed in to change notification settings - Fork 823
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Vue3: Fix onAfterRenderQuestion and onAfterRenderQuestionInput are fi…
…red with null html element (#7216) * Work for #7173: fix ref is not passed for some questions in Vue 3 * Work for #7173: fix onAfterRenderQuestion is not fired when quesiton is lazy rendered
- Loading branch information
Showing
7 changed files
with
91 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { ClientFunction, Selector } from "testcafe"; | ||
import { frameworks, url_test, initSurvey } from "../helper"; | ||
|
||
const title = "afterRenderQuestionEvent"; | ||
|
||
const json = { | ||
pages: [ | ||
{ | ||
name: "page1", | ||
title: "page one", | ||
elements: [ | ||
{ | ||
type: "radiogroup", | ||
name: "q1", | ||
choices: ["1", "2", "3"], | ||
}, | ||
{ | ||
type: "text", | ||
visibleIf: "{q1} = '1'", | ||
name: "q2", | ||
isRequired: true, | ||
}, | ||
{ | ||
type: "text", | ||
name: "q3", | ||
}, | ||
{ | ||
type: "text", | ||
name: "q4", | ||
} | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
frameworks.forEach((framework) => { | ||
fixture`${framework} ${title}`.page`${url_test}defaultV2/${framework}`.beforeEach(async (t) => { | ||
await t.resizeWindow(1920, 1080); | ||
}); | ||
test("afterRender is not fired when questions are lazy rendered", async (t) => { | ||
await ClientFunction(() => { | ||
(window as any).Survey.settings.lazyRowsRendering = true; | ||
})(); | ||
const f = (survey, options) => { | ||
options.htmlElement.setAttribute("test", true); | ||
}; | ||
const events = { onAfterRenderQuestion: f }; | ||
await initSurvey(framework, json, events); | ||
|
||
await t.click(Selector("label").nth(0)) | ||
.expect(Selector("div[data-name='q1']").hasAttribute("test")).ok() | ||
.expect(Selector("div[data-name='q2']").hasAttribute("test")).ok() | ||
.expect(Selector("div[data-name='q3']").hasAttribute("test")).ok() | ||
.expect(Selector("div[data-name='q4']").hasAttribute("test")).ok(); | ||
}); | ||
}); |