Skip to content

Commit

Permalink
Merge branch 'master' of github.com:surveyjs/survey-library into bugs…
Browse files Browse the repository at this point in the history
…/5725-save-data-notifications
  • Loading branch information
OlgaLarina committed Mar 17, 2023
2 parents 3ed4a5a + 17024cc commit b1b4b19
Show file tree
Hide file tree
Showing 13 changed files with 138 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## [1.9.78](https://github.com/surveyjs/survey-library/compare/v1.9.77...v1.9.78) (2023-03-15)


### Bug Fixes

* return original function name ([96fc3ff](https://github.com/surveyjs/survey-library/commit/96fc3ffedaab6ff02c25f2dab783c225c185e233))

## [1.9.77](https://github.com/surveyjs/survey-library/compare/v1.9.76...v1.9.77) (2023-03-07)

## [1.9.76](https://github.com/surveyjs/survey-library/compare/v1.9.75...v1.9.76) (2023-02-28)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"testcafe:ci:angular": "testcafe -c 4 -q chrome:headless testCafe/ --app \"http-server ./packages/survey-angular-ui/example/dist --proxy http://localhost:8080? -p 8080\" --selector-timeout 1500 --reporter minimal --env=angular",
"prepare": "husky install"
},
"version": "1.9.77",
"version": "1.9.78",
"name": "survey-library",
"private": true,
"devDependencies": {
Expand Down
7 changes: 7 additions & 0 deletions packages/survey-angular-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## [1.9.78](https://github.com/surveyjs/surveyjs/compare/v1.9.77...v1.9.78) (2023-03-15)


### Bug Fixes

* return original function name ([96fc3ff](https://github.com/surveyjs/surveyjs/commit/96fc3ffedaab6ff02c25f2dab783c225c185e233))

## [1.9.77](https://github.com/surveyjs/surveyjs/compare/v1.9.76...v1.9.77) (2023-03-07)

## [1.9.76](https://github.com/surveyjs/surveyjs/compare/v1.9.75...v1.9.76) (2023-02-28)
Expand Down
4 changes: 1 addition & 3 deletions packages/survey-angular-ui/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,10 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "3mb"
"maximumError": "3.5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "500kb",
"maximumError": "500kb"
}
],
Expand Down
2 changes: 1 addition & 1 deletion packages/survey-angular-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "survey-angular-ui",
"version": "1.9.77",
"version": "1.9.78",
"description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.",
"keywords": [
"Survey",
Expand Down
2 changes: 1 addition & 1 deletion src/defaultV2-theme/blocks/sd-element.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@mixin num_inline {
float: none;
margin-left: 0;
margin-inline-start: 0;
width: auto;
padding-left: 0;
padding-right: 0;
Expand Down
2 changes: 1 addition & 1 deletion src/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class ListModel<T extends BaseAction = Action> extends ActionContainer<T>
return this.getLocalizationString("filterStringPlaceholder");
}
public get emptyMessage(): string {
return this.getLocalizationString("emptyMessage");
return this.isAllDataLoaded ? this.getLocalizationString("emptyMessage") : this.loadingText;
}
public get scrollableContainer(): HTMLElement {
return this.listContainerHtmlElement.querySelector("." + this.getDefaultCssClasses().itemsContainer);
Expand Down
2 changes: 2 additions & 0 deletions src/multiSelectListModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export class MultiSelectListModel<T extends BaseAction = Action> extends ListMod
}

public onItemClick = (item: T) => {
if(this.isItemDisabled(item)) return;

this.isExpanded = false;
if (this.isItemSelected(item)) {
this.selectedItems.splice(this.selectedItems.indexOf(item), 1)[0];
Expand Down
10 changes: 10 additions & 0 deletions tests/listModelTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,16 @@ QUnit.test("onLastItemRended & hasVerticalScroller & isAllDataLoaded", function
document.body.removeChild(element);
});

QUnit.test("emptyText & isAllDataLoaded", function (assert) {
const items = createIActionArray(12);
const list = new ListModel(items, () => { }, true);
list.isAllDataLoaded = false;
assert.equal(list.emptyMessage, "Loading...");

list.isAllDataLoaded = true;
assert.equal(list.emptyMessage, "No data to display");
});

QUnit.test("getItemClass", (assert) => {
const items = createIActionArray(12);
const list = new ListModel(items, () => { }, true);
Expand Down
37 changes: 37 additions & 0 deletions tests/questionDropdownTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1065,4 +1065,41 @@ QUnit.test("ItemValue: check action fields", assert => {
question.value = "Item2";
assert.equal(question.visibleChoices[0].selected, false);
assert.equal(question.visibleChoices[1].selected, true);
});

QUnit.test("lazy loading placeholder", assert => {
const done = assert.async(2);

const json = {
questions: [{
"type": "dropdown",
"name": "q1",
"choicesLazyLoadEnabled": true
}]
};
const survey = new SurveyModel(json);
survey.onChoicesLazyLoad.add((_, opt) => {
setTimeout(() => { opt.setItems([], 0); }, 500);
});

const question = <QuestionDropdownModel>survey.getAllQuestions()[0];
const dropdownListModel = question.dropdownListModel;
const list: ListModel = dropdownListModel.popupModel.contentComponentData.model as ListModel;
assert.equal(list.actions.length, 0);
assert.equal(list.emptyMessage, "Loading...");
assert.equal(question.choices.length, 0);

question.dropdownListModel.popupModel.toggleVisibility();
setTimeout(() => {
assert.equal(list.actions.length, 0);
assert.equal(list.emptyMessage, "No data to display");
assert.equal(question.choices.length, 0);

setTimeout(() => {

done();
}, 550);

done();
}, 550);
});
52 changes: 52 additions & 0 deletions tests/question_tagbox_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -812,4 +812,56 @@ QUnit.test("Tagbox settings.tagboxCloseOnSelect", (assert) => {
assert.equal(question1.closeOnSelect, true);
assert.equal(question2.closeOnSelect, true);
settings.tagboxCloseOnSelect = false;
});

QUnit.test("maxSelectedChoices in tagbox", function (assert) {
const survey = new SurveyModel({
questions: [{
type: "tagbox",
name: "question1",
maxSelectedChoices: 2,
defaultValue: ["item1"],
choices: [
"item1",
"item2",
"item3",
"item4"
]
}]
});
const question = <QuestionTagboxModel>survey.getAllQuestions()[0];
const dropdownListModel = question.dropdownListModel;
const list: MultiSelectListModel = dropdownListModel.popupModel.contentComponentData.model as MultiSelectListModel;

assert.equal(list.actions.length, 4);
assert.equal(list.actions.filter(item => list.isItemSelected(item)).length, 1);
assert.equal(list.actions[0].enabled, true);
assert.equal(list.actions[1].enabled, true);
assert.equal(list.actions[2].enabled, true);
assert.equal(list.actions[3].enabled, true);
assert.deepEqual(question.value, ["item1"]);

list.onItemClick(list.actions[1]);
assert.equal(list.actions.filter(item => list.isItemSelected(item)).length, 2);
assert.equal(list.actions[0].enabled, true);
assert.equal(list.actions[1].enabled, true);
assert.equal(list.actions[2].enabled, false);
assert.equal(list.actions[3].enabled, false);
assert.deepEqual(question.value, ["item1", "item2"]);

list.onItemClick(list.actions[3]);
assert.equal(list.actions.filter(item => list.isItemSelected(item)).length, 2);
assert.equal(list.actions[0].enabled, true);
assert.equal(list.actions[1].enabled, true);
assert.equal(list.actions[2].enabled, false);
assert.equal(list.actions[3].enabled, false);
assert.deepEqual(question.value, ["item1", "item2"]);

list.onItemClick(list.actions[1]);
assert.equal(list.actions.filter(item => list.isItemSelected(item)).length, 1);
assert.equal(list.actions[0].enabled, true);
assert.equal(list.actions[1].enabled, true);
assert.equal(list.actions[2].enabled, true);
assert.equal(list.actions[3].enabled, true);
assert.deepEqual(question.value, ["item1"]);
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions visualRegressionTests/tests/defaultV2/responsiveness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,24 @@ frameworks.forEach(framework => {
await takeElementScreenshot("responsiveness-simple-question.png", Selector(".sd-question"), t, comparer);
});
});
test("Check simple question in small screen with rtl", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(600, 1080);
await ClientFunction(() => {
document.body.setAttribute("dir", "rtl");
})();
await initSurvey(framework, {
questions: [
{
type: "text",
name: "question_with_num",
title: "What can we improve or add to our Xamarin.Forms UI product line to better address your business needs in the future (control features, learning materials, etc.)?"
},
]
});
await takeElementScreenshot("responsiveness-simple-question-rtl.png", Selector(".sd-question"), t, comparer);
});
});
test("Check questions in one row in small screen", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(600, 1080);
Expand Down

0 comments on commit b1b4b19

Please sign in to comment.