Skip to content

Commit

Permalink
Coverage for beIdentifiable
Browse files Browse the repository at this point in the history
  • Loading branch information
mtabacman committed Feb 10, 2021
1 parent adad456 commit b193159
Show file tree
Hide file tree
Showing 15 changed files with 195 additions and 33 deletions.
11 changes: 11 additions & 0 deletions source/Willow-Core-Tests/AsynchronicButtonWebViewTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ Class {
#category : #'Willow-Core-Tests-WebViews'
}

{ #category : #'tests-rendering' }
AsynchronicButtonWebViewTest >> testBeIdentifiable [

| button html |

button := AsynchronicButtonWebView labeled: 'Click me!'.
button beIdentifiable.
html := self render: button.
self assert: html equals: '<button id="button-id1" type="button">Click me!</button>'
]

{ #category : #'tests-rendering' }
AsynchronicButtonWebViewTest >> testIdentifierOn [

Expand Down
14 changes: 14 additions & 0 deletions source/Willow-Core-Tests/CheckboxWebViewTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ CheckboxWebViewTest >> newBinaryChoiceView [
^ CheckboxWebView onModel: true offModel: false
]

{ #category : #'tests-configuring' }
CheckboxWebViewTest >> testBeIdentifiable [

| html binaryChoiceView |

binaryChoiceView := self newBinaryChoiceView.
binaryChoiceView beIdentifiable.
html := self render: binaryChoiceView.

self
assert: html
equals: '<input checked name="1" id="checkbox-id2" type="checkbox"/><input name="3" type="hidden"/>'
]

{ #category : #'tests-rendering' }
CheckboxWebViewTest >> testIdentifierOn [

Expand Down
13 changes: 13 additions & 0 deletions source/Willow-Core-Tests/DateFieldWebViewTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ DateFieldWebViewTest >> changeNotifiedBy: aTextFieldWebView [
notificationWasReceived := true
]

{ #category : #tests }
DateFieldWebViewTest >> testBeIdentifiable [

| dateField html |

dateField := DateFieldWebView applying: [ :field | ].

dateField beIdentifiable.
html := self render: dateField.

self assert: html equals: '<input value="" name="1" id="date-field-id2" type="date"/>'
]

{ #category : #tests }
DateFieldWebViewTest >> testDate [

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ MultipleSelectionListBoxWebViewTest >> testAllowsAnySatisfying [
deny: (listBox allowsAnySatisfying: [ :element | element isZero ])
]

{ #category : #'tests-configuring' }
MultipleSelectionListBoxWebViewTest >> testBeIdentifiable [

| listBox html |

listBox := self newListBox.
listBox beIdentifiable.

html := self render: listBox.

self
assert: html
equals: '<select name="1" id="list-box-id2" multiple></select><input name="3" type="hidden"/>'
]

{ #category : #'tests-Multiple Selection-API' }
MultipleSelectionListBoxWebViewTest >> testChooseAll [

Expand Down Expand Up @@ -118,7 +133,7 @@ MultipleSelectionListBoxWebViewTest >> testChooseAllMatching [
self assert: listBox currentSelection equals: #(2 4)
]

{ #category : #tests }
{ #category : #'tests-configuring' }
MultipleSelectionListBoxWebViewTest >> testIdentifierOn [

| listBox html |
Expand Down Expand Up @@ -185,7 +200,7 @@ MultipleSelectionListBoxWebViewTest >> testNotifyChangesWhenSelectionDoesNotChan
assert: listBox currentSelection isEmpty
]

{ #category : #'tests-rendering' }
{ #category : #'tests-configuring' }
MultipleSelectionListBoxWebViewTest >> testOn [

| listBox html |
Expand Down
13 changes: 13 additions & 0 deletions source/Willow-Core-Tests/NumberFieldWebViewTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ NumberFieldWebViewTest >> changeNotifiedBy: aTextFieldWebView [
notificationWasReceived := true
]

{ #category : #'tests-configuring' }
NumberFieldWebViewTest >> testBeIdentifiable [

| numberField html |

numberField := NumberFieldWebView applying: [ :field | ] transformingWith: IntegerCodec new.

numberField beIdentifiable.
html := self render: numberField.

self assert: html equals: '<input value="" name="1" id="number-field-id2" type="number"/>'
]

{ #category : #'tests-configuring' }
NumberFieldWebViewTest >> testIdentifierOn [

Expand Down
2 changes: 1 addition & 1 deletion source/Willow-Core-Tests/RadioGroupWebViewTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ A RadioGroupWebViewTest is a test class for testing the behavior of RadioGroupWe
"
Class {
#name : #RadioGroupWebViewTest,
#superclass : #SingleSelectionWebViewTest,
#superclass : #SingleSelectionWebViewBehaviorTest,
#category : #'Willow-Core-Tests-WebViews'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ A DropDownListWebViewTest is a test class for testing the behavior of DropDownLi
"
Class {
#name : #SingleSelectionWebViewAsDropDownListTest,
#superclass : #SingleSelectionWebViewTest,
#superclass : #SingleSelectionWebViewBehaviorTest,
#category : #'Willow-Core-Tests-WebViews'
}

Expand All @@ -14,6 +14,19 @@ SingleSelectionWebViewAsDropDownListTest >> newSingleSelectionView [
applyingToOptions: [ ]
]

{ #category : #'tests-configuring' }
SingleSelectionWebViewAsDropDownListTest >> testBeIdentifiable [

| dropDownList html |

dropDownList := self newSingleSelectionView.
dropDownList beIdentifiable.

html := self render: dropDownList.

self assert: html equals: '<select name="1" id="single-select-id2"></select>'
]

{ #category : #'tests-rendering' }
SingleSelectionWebViewAsDropDownListTest >> testCustomCommandForOptions [
| dropDownList html |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ A SingleSelectionListBoxWebViewTest is a test class for testing the behavior of
"
Class {
#name : #SingleSelectionWebViewAsListBoxTest,
#superclass : #SingleSelectionWebViewTest,
#superclass : #SingleSelectionWebViewBehaviorTest,
#category : #'Willow-Core-Tests-WebViews'
}

Expand All @@ -13,6 +13,19 @@ SingleSelectionWebViewAsListBoxTest >> newSingleSelectionView [
^ SingleSelectionWebView listBoxDisplayingAtOnce: 5
]

{ #category : #tests }
SingleSelectionWebViewAsListBoxTest >> testBeIdentifiable [

| listBox html |

listBox := self newSingleSelectionView.
listBox beIdentifiable.

html := self render: listBox.

self assert: html equals: '<select name="1" id="single-select-id2" size="5"></select>'
]

{ #category : #'tests-rendering' }
SingleSelectionWebViewAsListBoxTest >> testCustomCommandForOptions [
| dropDownList html |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
I'm an abstract test case for views implementing the single selection API
"
Class {
#name : #SingleSelectionWebViewTest,
#name : #SingleSelectionWebViewBehaviorTest,
#superclass : #BWRenderingTest,
#instVars : [
'notificationWasReceived'
Expand All @@ -11,25 +11,25 @@ Class {
}

{ #category : #testing }
SingleSelectionWebViewTest class >> isAbstract [
SingleSelectionWebViewBehaviorTest class >> isAbstract [

^self name = #SingleSelectionWebViewTest
^self name = #SingleSelectionWebViewBehaviorTest
]

{ #category : #support }
SingleSelectionWebViewTest >> changeNotifiedBy: aDropDownListWebView [
SingleSelectionWebViewBehaviorTest >> changeNotifiedBy: aDropDownListWebView [

notificationWasReceived := true
]

{ #category : #support }
SingleSelectionWebViewTest >> newSingleSelectionView [
SingleSelectionWebViewBehaviorTest >> newSingleSelectionView [

^self subclassResponsibility
]

{ #category : #'tests-Single Selection-API' }
SingleSelectionWebViewTest >> testAllowsAnySatisfying [
SingleSelectionWebViewBehaviorTest >> testAllowsAnySatisfying [

| singleSelectionView |

Expand All @@ -45,7 +45,7 @@ SingleSelectionWebViewTest >> testAllowsAnySatisfying [
]

{ #category : #'tests-Single Selection-API' }
SingleSelectionWebViewTest >> testChooseAny [
SingleSelectionWebViewBehaviorTest >> testChooseAny [

| singleSelectionView allowedElements |

Expand All @@ -65,7 +65,7 @@ SingleSelectionWebViewTest >> testChooseAny [
]

{ #category : #'tests-Single Selection-API' }
SingleSelectionWebViewTest >> testChooseEqualTo [
SingleSelectionWebViewBehaviorTest >> testChooseEqualTo [

| singleSelectionView allowedElements |

Expand All @@ -89,7 +89,7 @@ SingleSelectionWebViewTest >> testChooseEqualTo [
]

{ #category : #'tests-Single Selection-API' }
SingleSelectionWebViewTest >> testNotifyChangesTo [
SingleSelectionWebViewBehaviorTest >> testNotifyChangesTo [

| singleSelectionView |

Expand All @@ -103,7 +103,7 @@ SingleSelectionWebViewTest >> testNotifyChangesTo [
]

{ #category : #'tests-Single Selection-API' }
SingleSelectionWebViewTest >> testNotifyChangesWhenAvailableElementsChangeButContainsTheSelectedOne [
SingleSelectionWebViewBehaviorTest >> testNotifyChangesWhenAvailableElementsChangeButContainsTheSelectedOne [

| singleSelectionView |

Expand All @@ -124,7 +124,7 @@ SingleSelectionWebViewTest >> testNotifyChangesWhenAvailableElementsChangeButCon
]

{ #category : #'tests-Single Selection-API' }
SingleSelectionWebViewTest >> testNotifyChangesWhenAvailableElementsChangeButDoesNotContainTheSelectedOne [
SingleSelectionWebViewBehaviorTest >> testNotifyChangesWhenAvailableElementsChangeButDoesNotContainTheSelectedOne [

| singleSelectionView |

Expand All @@ -146,7 +146,7 @@ SingleSelectionWebViewTest >> testNotifyChangesWhenAvailableElementsChangeButDoe
]

{ #category : #'tests-Single Selection-API' }
SingleSelectionWebViewTest >> testNotifyChangesWhenSelectionChanged [
SingleSelectionWebViewBehaviorTest >> testNotifyChangesWhenSelectionChanged [

| singleSelectionView |

Expand All @@ -163,7 +163,7 @@ SingleSelectionWebViewTest >> testNotifyChangesWhenSelectionChanged [
]

{ #category : #'tests-Single Selection-API' }
SingleSelectionWebViewTest >> testNotifyChangesWhenSelectionDoesNotChange [
SingleSelectionWebViewBehaviorTest >> testNotifyChangesWhenSelectionDoesNotChange [

| singleSelectionView |

Expand All @@ -181,7 +181,7 @@ SingleSelectionWebViewTest >> testNotifyChangesWhenSelectionDoesNotChange [
]

{ #category : #'tests-Single Selection-API' }
SingleSelectionWebViewTest >> testWithCurrentSelectionDo [
SingleSelectionWebViewBehaviorTest >> testWithCurrentSelectionDo [

| singleSelectionView allowedElements |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,22 @@ Class {
#category : #'Willow-Core-Tests-WebViews'
}

{ #category : #tests }
{ #category : #'tests-configuring' }
SynchronicSubmitButtonWebViewTest >> testBeIdentifiable [

| synchronicButton html |

synchronicButton := SynchronicSubmitButtonWebView
labeled: 'Submit'
applying: [ :button | ]
evaluating: [ ].
synchronicButton beIdentifiable.
html := self render: synchronicButton.

self assert: html equals: '<button name="1" id="submit-button-id2" type="submit">Submit</button>'
]

{ #category : #'tests-configuring' }
SynchronicSubmitButtonWebViewTest >> testIdentifierOn [

| synchronicButton html |
Expand All @@ -28,7 +43,7 @@ SynchronicSubmitButtonWebViewTest >> testIdentifierOn [
equals: '<button name="2" id="submit-button-id1" type="submit">Click me!</button>'
]

{ #category : #'tests-rendering' }
{ #category : #'tests-configuring' }
SynchronicSubmitButtonWebViewTest >> testOn [

| synchronicButton html |
Expand Down
14 changes: 14 additions & 0 deletions source/Willow-Core-Tests/TableWebViewTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ TableWebViewTest >> changeNotifiedBy: aTableWebView [
notificationWasReceived := true
]

{ #category : #'tests-rendering' }
TableWebViewTest >> testBeIdentifiable [

| table html |

table := TableWebViewBuilder new
addColumn: [ :column | column rendering: [ :number | number even ] ];
build.
table beIdentifiable.

html := self render: table.
self assert: html equals: '<table id="table-id1"><tbody></tbody></table>'
]

{ #category : #'tests-rendering' }
TableWebViewTest >> testComplexTable [

Expand Down
12 changes: 12 additions & 0 deletions source/Willow-Core-Tests/TextFieldWebViewTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ TextFieldWebViewTest >> changeNotifiedBy: aTextFieldWebView [
notificationWasReceived := true
]

{ #category : #'tests - configuring' }
TextFieldWebViewTest >> testBeIdentifiable [

| textField html |

textField := TextFieldWebView singleLineApplying: [ :field | ].
textField beIdentifiable.
html := self render: textField.

self assert: html equals: '<input value="" name="1" id="text-id2" type="text"/>'
]

{ #category : #'tests - container-API' }
TextFieldWebViewTest >> testContents [

Expand Down
Loading

0 comments on commit b193159

Please sign in to comment.