Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event dispatcher pullup #221

Merged
merged 3 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .project
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
'srcDirectory' : 'source'
'srcDirectory' : 'source',
'tags': [ 'Buenos Aires Smalltalk' ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ CombinedWebInteractionInterpreterTest >> testShowLoadingNotificationDisplayingAp
self
assert: html
equals:
'<button id="button-id2" type="button">Ok</button><button id="button-id4" type="button">Cancel</button><script type="text/javascript">$("#button-id2").click(function(event){$("#willow-notification-section").html("<div class=\"willow\">Loading...<\/div>");Willow.callServer({"complete":function(){$("#willow-notification-section").html("")},"url":"/","data":"1"})});$("#button-id4").click(function(event){$("#willow-notification-section").html("<div class=\"willow\">Loading...<\/div>");Willow.callServer({"complete":function(){$("#willow-notification-section").html("")},"url":"/","data":"3"})});</script>'
'<button id="button-id2" type="button">Ok</button><button id="button-id4" type="button">Cancel</button><script type="text/javascript">$("#button-id2").click(function(event){$("#willow-notification-section").html("<div class=\"willow\">Loading...</div>");Willow.callServer({"complete":function(){$("#willow-notification-section").html("")},"url":"/","data":"1"})});$("#button-id4").click(function(event){$("#willow-notification-section").html("<div class=\"willow\">Loading...</div>");Willow.callServer({"complete":function(){$("#willow-notification-section").html("")},"url":"/","data":"3"})});</script>'
]

{ #category : 'tests - Configuring - DOM' }
Expand All @@ -723,7 +723,7 @@ CombinedWebInteractionInterpreterTest >> testShowLoadingNotificationStyledAsAll
self
assert: html
equals:
'<button id="button-id2" type="button">Ok</button><button id="button-id4" type="button">Cancel</button><script type="text/javascript">$("#button-id2").click(function(event){$("#willow-notification-section").html("<div>Loading...<\/div>");Willow.callServer({"complete":function(){$("#willow-notification-section").html("")},"url":"/","data":"1"})});$("#button-id4").click(function(event){$("#willow-notification-section").html("<div>Loading...<\/div>");Willow.callServer({"complete":function(){$("#willow-notification-section").html("")},"url":"/","data":"3"})});</script>'
'<button id="button-id2" type="button">Ok</button><button id="button-id4" type="button">Cancel</button><script type="text/javascript">$("#button-id2").click(function(event){$("#willow-notification-section").html("<div>Loading...</div>");Willow.callServer({"complete":function(){$("#willow-notification-section").html("")},"url":"/","data":"1"})});$("#button-id4").click(function(event){$("#willow-notification-section").html("<div>Loading...</div>");Willow.callServer({"complete":function(){$("#willow-notification-section").html("")},"url":"/","data":"3"})});</script>'
]

{ #category : 'tests - Configuring - DOM' }
Expand Down
2 changes: 1 addition & 1 deletion source/Willow-Core-Tests/DialogOpeningCommandTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ DialogOpeningCommandTest >> testModelLoadingInstructions [
self
assert: html
equals:
'<a id="a-id1"></a><script type="text/javascript">$("#a-id1").click(function(){$("#willow-dialog-section").append("<dialog open><\/dialog>")});</script>'
'<a id="a-id1"></a><script type="text/javascript">$("#a-id1").click(function(){$("#willow-dialog-section").append("<dialog open></dialog>")});</script>'
]

{ #category : 'tests-accessing' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ LoadingNotificationCommandTest >> testPriorityActions [
self
assert: html
equals:
'<a id="a-id1"></a><script type="text/javascript">$("#a-id1").click(function(){$("#willow-notification-section").html("<div>Loading...<\/div>");$.ajax({"complete":function(){$("#willow-notification-section").html("")}})});</script>'
'<a id="a-id1"></a><script type="text/javascript">$("#a-id1").click(function(){$("#willow-notification-section").html("<div>Loading...</div>");$.ajax({"complete":function(){$("#willow-notification-section").html("")}})});</script>'
]

{ #category : 'tests-accessing' }
Expand All @@ -74,7 +74,7 @@ LoadingNotificationCommandTest >> testPriorityActionsWithCustomView [
self
assert: html
equals:
'<a id="a-id1"></a><script type="text/javascript">$("#a-id1").click(function(){$("#willow-notification-section").html("<div class=\"willow-loading\"><span>Processing...<\/span><\/div>");$.ajax({"complete":function(){$("#willow-notification-section").html("")}})});</script>'
'<a id="a-id1"></a><script type="text/javascript">$("#a-id1").click(function(){$("#willow-notification-section").html("<div class=\"willow-loading\"><span>Processing...</span></div>");$.ajax({"complete":function(){$("#willow-notification-section").html("")}})});</script>'
]

{ #category : 'tests-testing' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,5 @@ PeriodicallyRenderedWebViewTest >> testScriptToRefreshAndRenderContentOn [
self
assert: html
equals:
'<div id="id3"></div><script type="text/javascript">$("#id3").html("Count: 2<br/><script type=\"text/javascript\">$.ajax({\"url\":\"/\",\"data\":\"2\"});<\/script>");</script>'
'<div id="id3"></div><script type="text/javascript">$("#id3").html("Count: 2<br/>\x3Cscript type=\"text/javascript\">$.ajax({\"url\":\"/\",\"data\":\"2\"});\x3C/script>");</script>'
]
2 changes: 1 addition & 1 deletion source/Willow-Core-Tests/RenderingCommandTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ RenderingCommandTest >> testModelLoadingInstructions [
self
assert: html
equals:
'<a id="id3"></a><script type="text/javascript">$("#id3").click(function(){$("#container-id1").html("<span>Test<\/span>")});</script>'
'<a id="id3"></a><script type="text/javascript">$("#id3").click(function(){$("#container-id1").html("<span>Test</span>")});</script>'
]

{ #category : 'tests-accessing' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ TemporarilyDisablingCommandTest >> testPriorityActions [
self
assert: html
equals:
'<a id="a-id1"></a><script type="text/javascript">$("#a-id1").click(function(){if(componentToDisable.attr("data-willow-events-disabled")!=="disabled"){componentToDisable.attr("data-willow-events-disabled","disabled").addClass("willow-disabled-component").attr("data-original-html",componentToDisable.html()).attr("disabled",true).html("<span class=\"willow-loading\"><\/span>");$.ajax({"complete":function(){componentToDisable.removeAttr("data-willow-events-disabled").attr("disabled",false).removeClass("willow-disabled-component").html(componentToDisable.attr("data-original-html"))}})}});</script>'
'<a id="a-id1"></a><script type="text/javascript">$("#a-id1").click(function(){if(componentToDisable.attr("data-willow-events-disabled")!=="disabled"){componentToDisable.attr("data-willow-events-disabled","disabled").addClass("willow-disabled-component").attr("data-original-html",componentToDisable.html()).attr("disabled",true).html("<span class=\"willow-loading\"></span>");$.ajax({"complete":function(){componentToDisable.removeAttr("data-willow-events-disabled").attr("disabled",false).removeClass("willow-disabled-component").html(componentToDisable.attr("data-original-html"))}})}});</script>'
]

{ #category : 'tests-testing' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ WebInteractionInterpreterTest >> testShowLoadingNotificationDisplayingApplying [
self
assert: html
equals:
'<input id="input-id2" type="text"/><script type="text/javascript">$("#input-id2").change(function(event){$("#willow-notification-section").html("<div class=\"willow\">Loading...<\/div>");Willow.callServer({"complete":function(){$("#willow-notification-section").html("")},"url":"/","data":"1"})});</script>'
'<input id="input-id2" type="text"/><script type="text/javascript">$("#input-id2").change(function(event){$("#willow-notification-section").html("<div class=\"willow\">Loading...</div>");Willow.callServer({"complete":function(){$("#willow-notification-section").html("")},"url":"/","data":"1"})});</script>'
]

{ #category : 'tests - Configuring - DOM' }
Expand All @@ -769,7 +769,7 @@ WebInteractionInterpreterTest >> testShowLoadingNotificationStyledAsAll [
self
assert: html
equals:
'<input id="input-id2" type="text"/><script type="text/javascript">$("#input-id2").change(function(event){$("#willow-notification-section").html("<div class=\"willow\">Loading...<\/div>");Willow.callServer({"complete":function(){$("#willow-notification-section").html("")},"url":"/","data":"1"})});</script>'
'<input id="input-id2" type="text"/><script type="text/javascript">$("#input-id2").change(function(event){$("#willow-notification-section").html("<div class=\"willow\">Loading...</div>");Willow.callServer({"complete":function(){$("#willow-notification-section").html("")},"url":"/","data":"1"})});</script>'
]

{ #category : 'tests - Configuring - DOM' }
Expand Down
24 changes: 0 additions & 24 deletions source/Willow-Core/CombinedEventInterpreterDispatcher.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@ CombinedEventInterpreterDispatcher class >> combiningInterpretersOfAll: aWebView
^ self combiningAll: ( aWebViewCollection collect: #on )
]

{ #category : 'configuring' }
CombinedEventInterpreterDispatcher >> change [

^ CombinedWebInteractionInterpreter combining: ( eventInterpreterDispatchers collect: #change )
]

{ #category : 'configuring' }
CombinedEventInterpreterDispatcher >> click [

^ CombinedWebInteractionInterpreter combining: ( eventInterpreterDispatchers collect: #click )
]

{ #category : 'configuring' }
CombinedEventInterpreterDispatcher >> eventNamed: anEventName [

Expand All @@ -46,18 +34,6 @@ CombinedEventInterpreterDispatcher >> initializeCombiningAll: anEventInterpreter
eventInterpreterDispatchers := anEventInterpreterDispatcherCollection
]

{ #category : 'configuring' }
CombinedEventInterpreterDispatcher >> keyUp [

^ CombinedWebInteractionInterpreter combining: ( eventInterpreterDispatchers collect: #keyUp )
]

{ #category : 'configuring' }
CombinedEventInterpreterDispatcher >> mouseOver [

^ CombinedWebInteractionInterpreter combining: ( eventInterpreterDispatchers collect: #mouseOver )
]

{ #category : 'configuring' }
CombinedEventInterpreterDispatcher >> trigger [

Expand Down
24 changes: 0 additions & 24 deletions source/Willow-Core/EventInterpreterDispatcher.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,6 @@ EventInterpreterDispatcher >> applyTo: aComponent on: aCanvas [
keysAndValuesDo: [ :event :interpreter | interpreter applyTo: aComponent on: aCanvas ]
]

{ #category : 'configuring' }
EventInterpreterDispatcher >> change [

^ self eventNamed: #change
]

{ #category : 'configuring' }
EventInterpreterDispatcher >> click [

^ self eventNamed: #click
]

{ #category : 'configuring' }
EventInterpreterDispatcher >> eventNamed: anEventName [

Expand All @@ -96,18 +84,6 @@ EventInterpreterDispatcher >> initializeInterpretingByDefault: anEventName confi
interpretersByEvent at: anEventName put: aWebInteractionInterpreter
]

{ #category : 'configuring' }
EventInterpreterDispatcher >> keyUp [

^ self eventNamed: #keyup
]

{ #category : 'configuring' }
EventInterpreterDispatcher >> mouseOver [

^ self eventNamed: #mouseover
]

{ #category : 'configuring' }
EventInterpreterDispatcher >> trigger [

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Class {
{ #category : 'configuring' }
EventInterpreterDispatcherBehavior >> change [

^ self subclassResponsibility
^ self eventNamed: #change
]

{ #category : 'configuring' }
EventInterpreterDispatcherBehavior >> click [

^ self subclassResponsibility
^ self eventNamed: #click
]

{ #category : 'configuring' }
Expand All @@ -27,13 +27,13 @@ EventInterpreterDispatcherBehavior >> eventNamed: anEventName [
{ #category : 'configuring' }
EventInterpreterDispatcherBehavior >> keyUp [

^ self subclassResponsibility
^ self eventNamed: #keyup
]

{ #category : 'configuring' }
EventInterpreterDispatcherBehavior >> mouseOver [

^ self subclassResponsibility
^ self eventNamed: #mouseover
]

{ #category : 'configuring' }
Expand Down
Loading