Skip to content

Commit

Permalink
Improve UnorderedListWebView so it can be used with the ListLabelingC…
Browse files Browse the repository at this point in the history
…ommand.
  • Loading branch information
gcotelli committed May 2, 2017
1 parent 812d804 commit 994f99c
Show file tree
Hide file tree
Showing 27 changed files with 83 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests-Accessing
tests-Supplying
testAsynchronicButtonLabeledApplying

| supplier button html |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests-Accessing
tests-Supplying
testDateFieldApplying

| supplier field html |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests-Accessing
tests-Supplying
testDropdownListApplying

| supplier dropdownList html |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests-Accessing
tests-Supplying
testSingleLineTextFieldApplying

| supplier textField html |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests-Accessing
tests-Supplying
testSynchronicButtonLabeledApplyingEvaluating

| supplier button html |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
tests-Supplying
testUnorderedListApplyingListingApplyingToEach

| supplier list html |

supplier := Html5ComponentSupplier new.

list := supplier
unorderedListApplying: (ListLabelingCommand with: [ :item | 'N.<1p>' expandMacrosWith: item ])
listing: #(1 2 3)
applyingToEach: (ComponentClassificationCommand toStyleWith: 'item').

html := self render: list.

self assert: html equals: '<ul><li class="item">N.1</li><li class="item">N.2</li><li class="item">N.3</li></ul>'
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"testAsynchronicButtonLabeledApplying" : "GabrielOmarCotelli 4/11/2017 18:05",
"testDropdownListApplying" : "GabrielOmarCotelli 4/25/2017 11:14",
"testSynchronicButtonLabeledApplyingEvaluating" : "GabrielOmarCotelli 4/25/2017 11:13",
"testUpdateRoot" : "GabrielOmarCotelli 4/25/2017 11:16",
"testUnorderedListApplyingListingApplyingToEach" : "GabrielOmarCotelli 5/2/2017 17:51",
"testDateFieldApplying" : "GabrielOmarCotelli 4/20/2017 16:55",
"testNaturalNumberFieldApplying" : "GabrielOmarCotelli 4/27/2017 15:25",
"testSingleLineTextFieldApplying" : "GabrielOmarCotelli 4/25/2017 11:10"
"testSingleLineTextFieldApplying" : "GabrielOmarCotelli 4/25/2017 11:10",
"testUpdateRoot" : "GabrielOmarCotelli 4/25/2017 11:16"
},
"class" : { }
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
tests-rendering
testRenderContentOn

| container html |
| html |

container := ListItemWebView itemizing: 'Item' applying: CompositeComponentCommand empty.
html := self render: container.
html := self
renderUsing: [ :canvas |
| list |

self assert: html equals: '<li>Item</li>'
list := canvas unorderedList.
list with: [ canvas render: (ListItemWebView itemizing: 'Item' containedIn: list applying: CompositeComponentCommand empty) ] ].

self assert: html equals: '<ul><li>Item</li></ul>'
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
tests-rendering
testRenderContentOnWithCommands

| container html |
| html |

container := ListItemWebView itemizing: 'Item' applying: (ComponentClassificationCommand toStyleWith: 'item').
html := self render: container.
html := self
renderUsing: [ :canvas |
| list |

self assert: html equals: '<li class="item">Item</li>'
list := canvas unorderedList.
list
with: [ canvas render: (ListItemWebView itemizing: 'Item' containedIn: list applying: (ComponentClassificationCommand toStyleWith: 'item')) ] ].

self assert: html equals: '<ul><li class="item">Item</li></ul>'
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"instance" : {
"testRenderContentOn" : "GabrielOmarCotelli 1/31/2017 14:21",
"testRenderContentOnWithCommands" : "GabrielOmarCotelli 1/31/2017 14:22"
"testRenderContentOn" : "GabrielOmarCotelli 5/2/2017 17:50",
"testRenderContentOnWithCommands" : "GabrielOmarCotelli 5/2/2017 17:50"
},
"class" : { }
}
2 changes: 1 addition & 1 deletion source/Willow-Tests.package/monticello.meta/version

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Supplying
unorderedListApplying: aCommandToList listing: aCollection applyingToEach: aCommandToItem

^ self subclassResponsibility
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"singleLineTextFieldApplying:" : "GabrielOmarCotelli 4/25/2017 11:00",
"dropdownListApplying:" : "GabrielOmarCotelli 4/3/2017 09:40",
"naturalNumberFieldApplying:" : "GabrielOmarCotelli 4/27/2017 15:23",
"unorderedListApplying:listing:applyingToEach:" : "GabrielOmarCotelli 5/2/2017 17:20",
"updateRoot:" : "GabrielOmarCotelli 4/3/2017 09:51",
"asynchronicButtonLabeled:applying:" : "GabrielOmarCotelli 4/11/2017 16:53",
"synchronicButtonLabeled:applying:evaluating:" : "GabrielOmarCotelli 4/25/2017 10:33",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Supplying
unorderedListApplying: aCommandToList listing: aCollection applyingToEach: aCommandToItem

^ UnorderedListWebView applying: aCommandToList listing: aCollection applyingToEach: aCommandToItem
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"singleLineTextFieldApplying:" : "GabrielOmarCotelli 4/25/2017 11:00",
"dropdownListApplying:" : "GabrielOmarCotelli 4/4/2017 17:20",
"naturalNumberFieldApplying:" : "GabrielOmarCotelli 4/27/2017 15:23",
"unorderedListApplying:listing:applyingToEach:" : "GabrielOmarCotelli 5/2/2017 17:21",
"updateRoot:" : "GabrielOmarCotelli 4/4/2017 17:21",
"asynchronicButtonLabeled:applying:" : "GabrielOmarCotelli 4/11/2017 16:52",
"synchronicButtonLabeled:applying:evaluating:" : "GabrielOmarCotelli 4/25/2017 10:33",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
instance creation
itemizing: anObject containedIn: aList applying: aComponentCommand

^ self new initializeItemizing: anObject containedIn: aList applying: aComponentCommand

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initialize-release
initializeItemizing: anObject containedIn: aList applying: aComponentCommand

item := anObject.
list := aList.
commandToComponent := aComponentCommand
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ renderContentOn: aCanvas

component := aCanvas listItem.
commandToComponent applyTo: component on: aCanvas.
component with: itemView
component with: (list labelForOption: item)
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"instance" : {
"initializeItemizing:applying:" : "MaximilianoTabacman 1/31/2017 00:33",
"renderContentOn:" : "MaximilianoTabacman 1/31/2017 00:32"
"initializeItemizing:containedIn:applying:" : "GabrielOmarCotelli 5/2/2017 17:38",
"renderContentOn:" : "GabrielOmarCotelli 5/2/2017 17:38"
},
"class" : {
"itemizing:applying:" : "MaximilianoTabacman 1/31/2017 00:33"
"itemizing:containedIn:applying:" : "GabrielOmarCotelli 5/2/2017 17:39"
}
}
5 changes: 3 additions & 2 deletions source/Willow.package/ListItemWebView.class/properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"itemView",
"commandToComponent"
"commandToComponent",
"list",
"item"
],
"name" : "ListItemWebView",
"type" : "normal"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
initialize-release
initializeApplying: aComponentCommand listing: anElementCollection applyingToEach: anElementCommand

listItemViews := anElementCollection
collect: [ :anElement | ListItemWebView itemizing: anElement applying: anElementCommand ].
commandToComponent := aComponentCommand
elements := anElementCollection.
commandToItem := anElementCommand.
commandToList := aComponentCommand
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
rendering
renderContentOn: aCanvas

"The order is relevant"

| component |
| list |

component := aCanvas unorderedList.
commandToComponent applyTo: component on: aCanvas.
component with: listItemViews
list := aCanvas unorderedList.
"The order is relevant"
commandToList applyTo: list on: aCanvas.
list with: [ elements do: [ :anElement | aCanvas render: (ListItemWebView itemizing: anElement containedIn: list applying: commandToItem) ] ]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"instance" : {
"initializeApplying:listing:applyingToEach:" : "MaximilianoTabacman 1/31/2017 00:33",
"renderContentOn:" : "MaximilianoTabacman 1/31/2017 00:28"
"initializeApplying:listing:applyingToEach:" : "GabrielOmarCotelli 5/2/2017 17:43",
"renderContentOn:" : "GabrielOmarCotelli 5/2/2017 17:46"
},
"class" : {
"applying:listing:applyingToEach:" : "MaximilianoTabacman 1/31/2017 00:28"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"listItemViews",
"commandToComponent"
"elements",
"commandToItem",
"commandToList"
],
"name" : "UnorderedListWebView",
"type" : "normal"
Expand Down
Binary file modified source/Willow.package/monticello.meta/version
Binary file not shown.

0 comments on commit 994f99c

Please sign in to comment.