Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Oct 7, 2023
2 parents a252c0e + 300deb4 commit eaffc8a
Show file tree
Hide file tree
Showing 71 changed files with 173 additions and 92 deletions.
2 changes: 1 addition & 1 deletion build-scripts/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var webpackConfig = webpackConfigCreator({
packageJson
);

process.env.CHROME_BIN = require("puppeteer").executablePath();
//process.env.CHROME_BIN = require("puppeteer").executablePath();

/*setup ts config file for tests ("noImplicitAny": false)*/
webpackConfig.module.rules[0].options.configFile = "build-scripts/tsconfig.tests.json";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
[attr.inputmode]="dropdownModel.inputMode"
[attr.tabindex]="dropdownModel.inputReadOnly ? null : -1"
[attr.disabled]="model.isInputReadOnly ? true : null"
[attr.aria-label]="model.placeholder"
[attr.aria-controls]="dropdownModel.listElementId"
[attr.aria-expanded]="model.ariaExpanded"
[attr.aria-activedescendant]="dropdownModel.ariaActivedescendant"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
[attr.readonly]="!model.searchEnabled ? true : null"
[attr.disabled]="question.isInputReadOnly ? true : null"
[attr.size]="!model.inputStringRendered ? 1 : null"
[attr.aria-label]="question.placeholder"
[attr.aria-controls]="model.listElementId"
[attr.aria-expanded]="question.ariaExpanded"
[attr.aria-activedescendant]="model.ariaActivedescendant"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<ng-container *ngFor="let panel of renderedPanels; index as index">
<div [class]="model.getPanelWrapperCss()">
<ng-template [component]="{ name: getPanelComponentName(panel), data: getPanelComponentData(panel) }"></ng-template>
<ng-container *ngIf="model.panelRemoveButtonLocation ==='right'">
<sv-ng-paneldynamic-remove-btn *ngIf="model.canRemovePanel && panel.state != 'collapsed' && model.panelRemoveButtonLocation == 'right'" [data]="{ panel: panel, question: model }"></sv-ng-paneldynamic-remove-btn>
<ng-container *ngIf="model.panelRemoveButtonLocation ==='right' && model.canRemovePanel && panel.state != 'collapsed'">
<ng-template [component]="{ name: 'sv-paneldynamic-remove-btn', data: { data: { panel, question: model }}}"></ng-template>
</ng-container>
</div>
<!-- add track by [key]="'separator' + panel.id" -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
:id="question.getInputId()"
:tabindex="model.inputReadOnly ? undefined : -1"
:readonly="!model.searchEnabled ? true : undefined"
:aria-label="question.placeholder"
:aria-expanded="
question.ariaExpanded === null
? undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
:disabled="question.isInputReadOnly"
:inputmode="model.inputMode"
:role="model.filterStringEnabled ? question.ariaRole : undefined"
:aria-label="question.placeholder"
:aria-expanded="
question.ariaExpanded === null
? undefined
Expand Down
3 changes: 1 addition & 2 deletions src/knockout/components/dropdown/dropdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
<input type="text" autocomplete="off" data-bind="
textInput: model.inputStringRendered,
css: question.cssClasses.filterStringInput,
attr: {
'aria-label': question.placeholder,
attr: {
'aria-expanded': question.ariaExpanded,
'aria-controls': model.listElementId,
'aria-activedescendant': model.ariaActivedescendant,
Expand Down
1 change: 0 additions & 1 deletion src/knockout/components/tagbox/tagbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
size: !model.inputStringRendered ? 1 : null,
id: question.getInputId(),
role: model.filterStringEnabled ? question.ariaRole : undefined,
'aria-label': question.placeholder,
'aria-expanded': question.ariaExpanded,
'aria-controls': model.listElementId,
'aria-activedescendant': model.ariaActivedescendant,
Expand Down
1 change: 0 additions & 1 deletion src/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ export class Question extends SurveyElement<Question>
}
public setIsMobile(val: boolean) {
this.isMobile = val && (this.allowMobileInDesignMode() || !this.isDesignMode);
this.renderMinWidth = !val;
}
@property({ defaultValue: false }) isMobile: boolean;
@property() forceIsInputReadOnly: boolean;
Expand Down
4 changes: 0 additions & 4 deletions src/question_expression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,6 @@ export class QuestionExpressionModel extends Question {
}
return val.toString();
}
protected convertToCorrectValue(val: any): any {
if(Array.isArray(val)) return val.join(", ");
return val;
}
}

export function getCurrecyCodes(): Array<string> {
Expand Down
1 change: 0 additions & 1 deletion src/react/dropdown-base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ export class SurveyQuestionDropdownBase<T extends Question> extends SurveyQuesti
ref={(element) => (this.inputElement = element)}
className={this.question.cssClasses.filterStringInput}
role={dropdownListModel.filterStringEnabled ? this.question.ariaRole : undefined}
aria-label={this.question.placeholder}
aria-expanded={this.question.ariaExpanded === null ? undefined : this.question.ariaExpanded === "true"}
aria-controls={dropdownListModel.listElementId}
aria-activedescendant={dropdownListModel.ariaActivedescendant}
Expand Down
1 change: 0 additions & 1 deletion src/react/tagbox-filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export class TagboxFilterString extends SurveyElementBase<ITagboxFilterProps, an
readOnly={!this.model.searchEnabled ? true : undefined}
size={!this.model.inputStringRendered ? 1 : undefined}
role={this.model.filterStringEnabled ? this.question.ariaRole : undefined}
aria-label={this.question.placeholder}
aria-expanded={this.question.ariaExpanded === null ? undefined : this.question.ariaExpanded === "true"}
aria-controls={this.model.listElementId}
aria-activedescendant={this.model.ariaActivedescendant}
Expand Down
4 changes: 2 additions & 2 deletions src/survey-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -908,11 +908,11 @@ export class SurveyElement<E = any> extends SurveyElementCore implements ISurvey
}

@property({ defaultValue: true }) allowRootStyle: boolean;
@property({ defaultValue: true }) renderMinWidth: boolean;

get rootStyle() {
let style: { [index: string]: any } = {};
let minWidth = this.renderMinWidth ? this.minWidth : "min(100%, " + this.minWidth + ")";
let minWidth = this.minWidth;
if (minWidth != "auto") minWidth = "min(100%, " + this.minWidth + ")";
if (this.allowRootStyle && this.renderWidth) {
// style["width"] = this.renderWidth;
style["flexGrow"] = 1;
Expand Down
1 change: 0 additions & 1 deletion src/vue/components/dropdown/dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
:id="question.getInputId()"
:tabindex="model.inputReadOnly ? undefined : -1"
:readonly="!model.searchEnabled ? true : null"
:aria-label="question.placeholder"
:aria-expanded="question.ariaExpanded"
:aria-controls="model.listElementId"
:aria-activedescendant="model.ariaActivedescendant"
Expand Down
1 change: 0 additions & 1 deletion src/vue/components/tagbox/tagbox-filter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
v-bind:disabled="question.isInputReadOnly"
:inputmode="model.inputMode"
:role="model.filterStringEnabled ? question.ariaRole : null"
:aria-label="question.placeholder"
:aria-expanded="question.ariaExpanded"
:aria-controls="model.listElementId"
:aria-activedescendant="model.ariaActivedescendant"
Expand Down
4 changes: 2 additions & 2 deletions testCafe/survey/surveyWidth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ frameworks.forEach((framework) => {

test("Check question width", async (t) => {
await t
.expect(Selector(".sv_row > div").getStyleProperty("min-width")).eql("300px");
.expect(Selector(".sv_row > div").getStyleProperty("min-width")).eql("min(100% + 0px, 0% + 300px)");

await ClientFunction(() => { window["survey"].getAllQuestions()[0].minWidth = "200px"; })();
await t
.expect(Selector(".sv_row > div").getStyleProperty("min-width")).eql("200px");
.expect(Selector(".sv_row > div").getStyleProperty("min-width")).eql("min(100% + 0px, 0% + 200px)");
});
});
28 changes: 20 additions & 8 deletions tests/expressions/expressionParserTest.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import {
parse,
SyntaxError,
ParseFunction,
} from "../../src/expressions/expressionParser";

import { parse } from "../../src/expressions/expressionParser";
import { ConditionRunner, ExpressionRunner } from "../../src/conditions";

import { ConditionsParser } from "../../src/conditionsParser";
import { ConsoleWarnings } from "../../src/console-warnings";
import {
Expand Down Expand Up @@ -1496,4 +1490,22 @@ QUnit.test("Warn in console if the expression is invalid", function(assert) {
runner.run({});
assert.notOk(reportText);
ConsoleWarnings.warn = prev;
});
});
QUnit.test("Custom function returns object&array, #7050", function(assert) {
function func1(params: any[]): any {
return { a: 1, b: 2 };
}
function func2(params: any[]): any {
return [{ a: 1 }, { b: 2 }];
}
FunctionFactory.Instance.register("func1", func1);
FunctionFactory.Instance.register("func2", func2);

let runner = new ExpressionRunner("func1()");
assert.deepEqual(runner.run({}, {}), { a: 1, b: 2 }, "function returns object");
runner.expression = "func2()";
assert.deepEqual(runner.run({}, {}), [{ a: 1 }, { b: 2 }], "function returns array");

FunctionFactory.Instance.unregister("func1");
FunctionFactory.Instance.unregister("func2");
});
2 changes: 1 addition & 1 deletion tests/markup/etalon_paneldynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ registerMarkupTests(
snapshot: "paneldynamic-no-footer-1",
removeIds: true,
excludePlatform: "Vue",
before: () => StylesManager.applyTheme("defaultV2"),
before: () => { StylesManager.applyTheme("defaultV2"); },
after: () => StylesManager.applyTheme("default"),
},
{
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/dropdown-aria-expanded.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="sv_select_wrapper">
<div aria-controls="testid0i_list" aria-expanded="true" aria-invalid="false" aria-label="Question title" aria-required="false" class="sv_q_dropdown_control" id="testid0i" role="combobox">
<div class="sv_q_dropdown__value">
<input aria-controls="testid0i_list" aria-expanded="true" aria-label="Select..." autocomplete="off" class="sv_q_dropdown__filter-string-input" id="testid0i_0" inputmode="text" placeholder="Select..." role="combobox" type="text">
<input aria-controls="testid0i_list" aria-expanded="true" autocomplete="off" class="sv_q_dropdown__filter-string-input" id="testid0i_0" inputmode="text" placeholder="Select..." role="combobox" type="text">
</div>
<div class="sv_q_dropdown_clean-button" style="display:none;">
<svg aria-label="Clear" class="sv_q_dropdown_clean-button-svg sv-svg-icon" role="img">
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/dropdown-input-string.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<span style="visibility:hidden;">o</span>
<span>rd</span>
</div>
<input aria-controls="testid0i_list" aria-expanded="true" aria-label="Select..." autocomplete="off" class="sv_q_dropdown__filter-string-input" inputmode="text" placeholder="" role="combobox" type="text">
<input aria-controls="testid0i_list" aria-expanded="true" autocomplete="off" class="sv_q_dropdown__filter-string-input" inputmode="text" placeholder="" role="combobox" type="text">
</div>
<div class="sv_q_dropdown_clean-button" style="display:none;">
<svg aria-label="Clear" class="sv_q_dropdown_clean-button-svg sv-svg-icon" role="img">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div aria-controls="testid0i_list" aria-expanded="false" aria-invalid="false" aria-label="Question title" aria-required="false" class="sv_q_dropdown_control" id="testid0i" role="combobox">
<div class="sv_q_dropdown__value">
<span class="sv-string-viewer">item1</span>
<input aria-controls="testid0i_list" aria-expanded="false" aria-label="Select..." autocomplete="off" class="sv_q_dropdown__filter-string-input" id="testid0i_0" inputmode="text" placeholder="" role="combobox" type="text">
<input aria-controls="testid0i_list" aria-expanded="false" autocomplete="off" class="sv_q_dropdown__filter-string-input" id="testid0i_0" inputmode="text" placeholder="" role="combobox" type="text">
</div>
<div class="sv_q_dropdown_clean-button">
<svg aria-label="Clear" class="sv_q_dropdown_clean-button-svg sv-svg-icon" role="img">
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/dropdown-select-mobile.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="sv_select_wrapper">
<div aria-controls="testid0i_list" aria-expanded="false" aria-invalid="false" aria-label="Question title" aria-required="false" class="sv_q_dropdown_control" id="testid0i" role="combobox">
<div class="sv_q_dropdown__value">
<input aria-controls="testid0i_list" aria-expanded="false" aria-label="Select..." autocomplete="off" class="sv_q_dropdown__filter-string-input" id="testid0i_0" inputmode="none" placeholder="Select..." role="combobox" type="text">
<input aria-controls="testid0i_list" aria-expanded="false" autocomplete="off" class="sv_q_dropdown__filter-string-input" id="testid0i_0" inputmode="none" placeholder="Select..." role="combobox" type="text">
</div>
</div>
<div>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/dropdown-select.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="sv_select_wrapper">
<div aria-controls="testid0i_list" aria-expanded="false" aria-invalid="false" aria-label="Question title" aria-required="false" class="sv_q_dropdown_control" id="testid0i" role="combobox">
<div class="sv_q_dropdown__value">
<input aria-controls="testid0i_list" aria-expanded="false" aria-label="Select..." autocomplete="off" class="sv_q_dropdown__filter-string-input" id="testid0i_0" inputmode="text" placeholder="Select..." role="combobox" type="text">
<input aria-controls="testid0i_list" aria-expanded="false" autocomplete="off" class="sv_q_dropdown__filter-string-input" id="testid0i_0" inputmode="text" placeholder="Select..." role="combobox" type="text">
</div>
</div>
<div>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/dropdown-with-markdown.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div aria-controls="testid0i_list" aria-expanded="false" aria-invalid="false" aria-label="Question title" aria-required="false" class="sv_q_dropdown_control" id="testid0i" role="combobox">
<div class="sv_q_dropdown__value">
<span class="sv-string-viewer">Cat: ![A cat](https://surveyjs.io/Content/Images/examples/markdown/cat.svg =14x14)</span>
<input aria-controls="testid0i_list" aria-expanded="false" aria-label="Select..." autocomplete="off" class="sv_q_dropdown__filter-string-input" id="testid0i_0" inputmode="text" placeholder="" role="combobox" type="text">
<input aria-controls="testid0i_list" aria-expanded="false" autocomplete="off" class="sv_q_dropdown__filter-string-input" id="testid0i_0" inputmode="text" placeholder="" role="combobox" type="text">
</div>
<div class="sv_q_dropdown_clean-button">
<svg aria-label="Clear" class="sv_q_dropdown_clean-button-svg sv-svg-icon" role="img">
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/dropdown-with-none-value.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div aria-controls="testid0i_list" aria-expanded="false" aria-invalid="false" aria-label="Question title" aria-required="false" class="sv_q_dropdown_control" id="testid0i" role="combobox">
<div class="sv_q_dropdown__value">
<span class="sv-string-viewer">None</span>
<input aria-controls="testid0i_list" aria-expanded="false" aria-label="Select..." autocomplete="off" class="sv_q_dropdown__filter-string-input" id="testid0i_0" inputmode="text" placeholder="" role="combobox" type="text">
<input aria-controls="testid0i_list" aria-expanded="false" autocomplete="off" class="sv_q_dropdown__filter-string-input" id="testid0i_0" inputmode="text" placeholder="" role="combobox" type="text">
</div>
<div class="sv_q_dropdown_clean-button">
<svg aria-label="Clear" class="sv_q_dropdown_clean-button-svg sv-svg-icon" role="img">
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/dropdown-with-other-value.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div aria-controls="testid0i_list" aria-expanded="false" aria-invalid="false" aria-label="Question title" aria-required="false" class="sv_q_dropdown_control" id="testid0i" role="combobox">
<div class="sv_q_dropdown__value">
<span class="sv-string-viewer">Other (describe)</span>
<input aria-controls="testid0i_list" aria-expanded="false" aria-label="Select..." autocomplete="off" class="sv_q_dropdown__filter-string-input" id="testid0i_0" inputmode="text" placeholder="" role="combobox" type="text">
<input aria-controls="testid0i_list" aria-expanded="false" autocomplete="off" class="sv_q_dropdown__filter-string-input" id="testid0i_0" inputmode="text" placeholder="" role="combobox" type="text">
</div>
<div class="sv_q_dropdown_clean-button">
<svg aria-label="Clear" class="sv_q_dropdown_clean-button-svg sv-svg-icon" role="img">
Expand Down

0 comments on commit eaffc8a

Please sign in to comment.