forked from surveyjs/survey-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the bug with panel visibility: surveyjs#656
- Loading branch information
1 parent
0c23ebc
commit a1f3bff
Showing
3 changed files
with
41 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import {SurveyModel} from "../src/survey"; | ||
import {PageModel} from "../src/page"; | ||
import {PanelModel, QuestionRowModel} from "../src/panel"; | ||
import {QuestionFactory} from "../src/questionfactory"; | ||
import {Question} from "../src/question"; | ||
import {QuestionTextModel} from "../src/question_text"; | ||
import {JsonObject, JsonUnknownPropertyError} from "../src/jsonobject"; | ||
|
||
export default QUnit.module("ElementsLayout"); | ||
|
||
QUnit.test("Simple layout test", function (assert) { | ||
var page = new PageModel(); | ||
page.addNewQuestion("text", "q1"); | ||
page.addNewQuestion("text", "q2"); | ||
assert.equal(page.rows.length, 2, "There are two rows"); | ||
assert.equal(page.questions[0].renderWidth, "100%", "The render width is 100%"); | ||
page.questions[1].startWithNewLine = false; | ||
assert.equal(page.rows.length, 1, "There is one row"); | ||
assert.equal(page.questions[0].renderWidth, "50%", "The render width is 50%"); | ||
}); | ||
QUnit.test("Two panels test", function (assert) { | ||
var page = new PageModel(); | ||
var panel1 = page.addNewPanel("p1"); | ||
var panel2 = page.addNewPanel("p2"); | ||
panel2.startWithNewLine = false; | ||
panel1.addNewQuestion("text", "p1_q1"); | ||
panel2.addNewQuestion("text", "p1_q2"); | ||
assert.equal(page.rows.length, 1, "There is one row"); | ||
assert.equal(page.elements[0].renderWidth, "50%", "1. The render width is 50%"); | ||
panel2.elements[0].visible = false; | ||
assert.equal(page.elements[0].renderWidth, "100%", "2. The panel1 render width is 100%"); | ||
assert.equal(page.elements[1].renderWidth, "", "2. The panel2 render width is empty"); | ||
panel2.elements[0].visible = true; | ||
assert.equal(page.elements[0].renderWidth, "50%", "3. The panel1 render width is 50% again"); | ||
assert.equal(page.elements[1].renderWidth, "50%", "3. The panel2 The render width is 50% again"); | ||
}); |
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