-
Notifications
You must be signed in to change notification settings - Fork 0
/
JQueryUIComponentSupplierTest.class.st
214 lines (170 loc) · 7.71 KB
/
JQueryUIComponentSupplierTest.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
Class {
#name : #JQueryUIComponentSupplierTest,
#superclass : #BWRenderingTest,
#category : #'Willow-JQueryUI-Tests-Frontend'
}
{ #category : #private }
JQueryUIComponentSupplierTest >> assertRenderingOf: aComponentCreationBlock equals: anExpectedHtml [
| component html |
component := aComponentCreationBlock value: JQueryUIComponentSupplier online.
html := self render: component.
self assert: html equals: anExpectedHtml
]
{ #category : #'tests-Supplying' }
JQueryUIComponentSupplierTest >> testAsynchronicButtonLabeledApplying [
self
assertRenderingOf:
[ :supplier | supplier asynchronicButtonLabeled: 'Buy' applying: [ :button | button addClass willow ] ]
equals: '<button class="willow" type="button">Buy</button>'
]
{ #category : #'tests-Supplying' }
JQueryUIComponentSupplierTest >> testAsynchronicLinkLabeledApplying [
self
assertRenderingOf:
[ :supplier | supplier asynchronicLinkLabeled: 'Buy' applying: [ :link | link addClass willow ] ]
equals:
'<a id="a-id1" class="willow">Buy</a><script type="text/javascript">$("#a-id1").click(function(event){arguments[0].preventDefault()});</script>'
]
{ #category : #'tests-Supplying' }
JQueryUIComponentSupplierTest >> testCheckboxLabeledOnModelOffModelApplying [
self
assertRenderingOf: [ :supplier |
supplier
checkboxLabeled: 'Labelization'
onModel: 3
offModel: 'the off'
applying: [ :checkbox | checkbox addClass willow ] ]
equals:
'<input class="willow" checked name="1" id="checkbox-id2" type="checkbox"/><input name="3" type="hidden"/><label for="checkbox-id2">Labelization</label>'
]
{ #category : #'tests-Supplying' }
JQueryUIComponentSupplierTest >> testCheckboxUnlabeledOnModelOffModelApplying [
self
assertRenderingOf: [ :supplier |
supplier
checkboxUnlabeledOnModel: 3
offModel: 'the off'
applying: [ :checkbox | checkbox addClass willow ] ]
equals:
'<input class="willow" checked name="1" type="checkbox"/><input name="2" type="hidden"/>'
]
{ #category : #'tests-Supplying' }
JQueryUIComponentSupplierTest >> testDecimalNumberFieldApplying [
self
assertRenderingOf: [ :supplier | supplier decimalNumberFieldApplying: [ :field | field addClass willow ] ]
equals: '<input value="" name="1" type="number" class="willow"/>'
]
{ #category : #'tests-Supplying' }
JQueryUIComponentSupplierTest >> testDropdownListApplying [
self
assertRenderingOf:
[ :supplier | supplier dropdownListApplying: [ :dropdownList | dropdownList addClass willow ] ]
equals: '<select name="1" class="willow"></select>'
]
{ #category : #'tests-Supplying' }
JQueryUIComponentSupplierTest >> testFieldSetContainingApplyingWithLegendApplying [
self
assertRenderingOf: [ :supplier |
supplier
fieldSetContaining: 'The View'
applying: [ :fieldSet | fieldSet beDisabled ]
withLegend: 'Its Title'
applying: [ :legend | legend beAutofocused ] ]
equals:
'<fieldset disabled><legend autofocus>Its Title</legend>The View</fieldset>'
]
{ #category : #'tests-Supplying' }
JQueryUIComponentSupplierTest >> testMultiLineTextFieldApplying [
self
assertRenderingOf:
[ :supplier | supplier multiLineTextFieldApplying: [ :textField | textField addClass willow ] ]
equals: '<textarea rows="auto" cols="auto" name="1" class="willow"></textarea>'
]
{ #category : #'tests-Supplying' }
JQueryUIComponentSupplierTest >> testMultipleSelectionListBoxDisplayingAtOnceApplying [
self
assertRenderingOf:
[ :supplier | supplier multipleSelectionListBoxDisplayingAtOnce: 10 applying: [ :listBox | ] ]
equals: '<select name="1" size="10" multiple></select><input name="2" type="hidden"/>'
]
{ #category : #'tests-Supplying' }
JQueryUIComponentSupplierTest >> testNaturalNumberFieldApplying [
self
assertRenderingOf: [ :supplier | supplier naturalNumberFieldApplying: [ :field | field addClass willow ] ]
equals: '<input value="" name="1" type="number" min="0" class="willow"/>'
]
{ #category : #'tests-Supplying' }
JQueryUIComponentSupplierTest >> testRadioRenderingWithApplyingToLabelApplyingToInput [
self
assertRenderingOf:
[ :supplier | supplier radioRenderingWith: #asUppercase applyingToLabel: [ :radio | radio addClass willow ] applyingToInput: [ :radio | radio addClass willow ] ]
equals: ''.
self
assertRenderingOf: [ :supplier |
(supplier radioRenderingWith: #asUppercase applyingToLabel: [ :radio | radio addClass willow ] applyingToInput: [ :radio | radio addClass willow ])
allowAnyOf: #(f h);
yourself ]
equals:
'<label for="radio-button-id2" class="willow"><input name="1" id="radio-button-id2" class="willow" value="1" type="radio"/>F</label><label for="radio-button-id3" class="willow"><input name="1" id="radio-button-id3" class="willow" value="2" type="radio"/>H</label>'
]
{ #category : #'tests-Supplying' }
JQueryUIComponentSupplierTest >> testSingleLineTextFieldApplying [
self
assertRenderingOf:
[ :supplier | supplier singleLineTextFieldApplying: [ :textField | textField addClass willow ] ]
equals: '<input value="" name="1" class="willow" type="text"/>'
]
{ #category : #'tests-Supplying' }
JQueryUIComponentSupplierTest >> testSingleSelectionListBoxDisplayingAtOnceApplying [
self
assertRenderingOf: [ :supplier |
supplier
singleSelectionListBoxDisplayingAtOnce: 15
applying: [ :listBox | listBox addClass willow ] ]
equals: '<select name="1" size="15" class="willow"></select>'
]
{ #category : #'tests-Supplying' }
JQueryUIComponentSupplierTest >> testSynchronicButtonLabeledApplyingEvaluating [
self
assertRenderingOf: [ :supplier |
supplier
synchronicButtonLabeled: 'Buy'
applying: [ :button | button addClass willow ]
evaluating: [ ] ]
equals: '<button name="1" class="willow" type="submit">Buy</button>'
]
{ #category : #'tests-Supplying' }
JQueryUIComponentSupplierTest >> testUnorderedListApplyingListingApplyingToEach [
self
assertRenderingOf: [ :supplier |
supplier
unorderedListApplying: [ :list | list labelItemsWith: [ :item | 'N.<1p>' expandMacrosWith: item ] ]
listing: #(1 2 3)
applyingToEach: [ :listItem | listItem addClass willow ] ]
equals:
'<ul><li class="willow">N.1</li><li class="willow">N.2</li><li class="willow">N.3</li></ul>'
]
{ #category : #'tests-Processing' }
JQueryUIComponentSupplierTest >> testUpdateRoot [
| html |
html := WAHtmlCanvas builder
fullDocument: true;
rootBlock: [ :root | JQueryUIComponentSupplier online updateRoot: root ];
render: [ :canvas | ].
self
assert: html
equals:
'<!DOCTYPE html><html><head><title></title><meta name="viewport" content="width=device-width, initial-scale=1.0"/><script type="text/javascript" src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script><link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.13.2/themes/pepper-grinder/jquery-ui.css"/></head><body onload="onLoad()"><script type="text/javascript">function onLoad(){};</script></body></html>'
]
{ #category : #'tests-Processing' }
JQueryUIComponentSupplierTest >> testUpdateRootWithSelfHostedLibraries [
| html |
html := WAHtmlCanvas builder
fullDocument: true;
rootBlock: [ :root | (JQueryUIComponentSupplier withJQueryUILibrary: JQueryUIDevelopmentMetadataLibrary default) updateRoot: root ];
render: [ :canvas | ].
self
assert: html
equals:
'<!DOCTYPE html><html><head><title></title><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link rel="stylesheet" type="text/css" href="/files/jquery-ui-1.13.2/themes/pepper-grinder/theme.css"/><link rel="stylesheet" type="text/css" href="/files/jquery-ui-1.13.2/themes/pepper-grinder/jquery-ui.css"/><script type="text/javascript" src="/files/jquery-ui-1.13.2/jquery-ui.js"></script></head><body onload="onLoad()"><script type="text/javascript">function onLoad(){};</script></body></html>'
]