-
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.
added test and refactored according to project conventions
- Loading branch information
Ingmar Vogel
committed
May 20, 2024
1 parent
1545317
commit e377a8d
Showing
4 changed files
with
23 additions
and
8 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
packages/Liquid-Tests.package/LQPollDraftTests.class/instance/testRemoveQuestion.st
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,16 @@ | ||
testing | ||
testRemoveQuestion | ||
|
||
| question1 question2| | ||
self assert: self pollDraft questionList isEmpty. | ||
|
||
question1 := LQChoicesQuestion new. | ||
question1 title: 'An interesting first question!'. | ||
self pollDraft addQuestion: question1. | ||
question2 := LQChoicesQuestion new. | ||
question2 title: 'An interesting second question!'. | ||
self pollDraft addQuestion: question2. | ||
|
||
self pollDraft removeQuestionAt: 1. | ||
self assert: self pollDraft questionList size equals: 1. | ||
self assert: self pollDraft questionList first title equals: 'An interesting second question!' |
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
10 changes: 4 additions & 6 deletions
10
packages/Liquid-UI.package/LQPollDraftBuilder.class/instance/removeQuestion.st
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 |
---|---|---|
@@ -1,9 +1,7 @@ | ||
modifying | ||
removeQuestion | ||
|
||
self questionBuilders size > 1 | ||
ifTrue:[ | ||
self pollDraft removeQuestionAt: self getIndex. | ||
self removeQuestionBuilderAt: self getIndex. | ||
self setIndex: self questionBuilders size. | ||
self changed: #list] | ||
self questionBuilders size > 1 ifTrue: [self pollDraft removeQuestionAt: self getIndex. | ||
self removeQuestionBuilderAt: self getIndex. | ||
self setIndex: self questionBuilders size. | ||
self changed: #list] |
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