Skip to content

Commit

Permalink
Fixed #5282 - If question width is small for text type then changing …
Browse files Browse the repository at this point in the history
…input type breaks adaptivity
  • Loading branch information
tsv2013 committed Mar 7, 2024
1 parent 8713e7c commit 70b05fa
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/survey-creator-react/src/ModelElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ export class CreatorModelElement<P, S> extends SurveyElementBase<P, S> {
shouldComponentUpdate(nextProps: any, nextState: any): boolean {
const result = super.shouldComponentUpdate(nextProps, nextState);
if (result) {
if (this.needUpdateModel(this.props)) {
if (this.needUpdateModel(nextProps)) {
this.createModel(nextProps);
}
}
return result;
}
protected createModel(props: any): void { }
protected needUpdateModel(prevProps: any): boolean {
protected needUpdateModel(nextProps: any): boolean {
const names = this.getUpdatedModelProps();
if (!Array.isArray(names)) return true;
for (var i = 0; i < names.length; i++) {
const key = names[i];
if (this.props[key] !== prevProps[key]) return true;
if (this.props[key] !== nextProps[key]) return true;
}
return false;
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions visualRegressionTests/tests/designer/surface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1999,6 +1999,7 @@ test("Check adorner actions responsivity after convert", async (t) => {
.click(Selector("div[data-sv-drop-target-survey-element='question3'] .sv-list__item-body[title='Yes/No (Boolean)']"))
.hover(Selector(".svc-question__adorner").nth(1), { offsetX: 10, offsetY: 10 }).click(Selector(".svc-question__adorner").nth(1), { offsetX: 10, offsetY: 10 })
.hover(Selector(".svc-question__adorner").nth(2), { offsetX: 10, offsetY: 10 }).click(Selector(".svc-question__adorner").nth(2), { offsetX: 10, offsetY: 10 });
await ClientFunction(() => { document.body.focus(); })();
await t.wait(100);
await takeElementScreenshot("actions-on-converted-question.png", root.nth(0), t, comparer);
});
Expand Down

0 comments on commit 70b05fa

Please sign in to comment.