Skip to content

Commit

Permalink
Browser: Changed HTML Label elements without "for" to other element t…
Browse files Browse the repository at this point in the history
…ypes

Mostly to HTML paragraph elements.
To prevent warnings in browser dev mode.
  • Loading branch information
FunctionPoint committed Jul 4, 2024
1 parent a8aaaad commit 90e8509
Show file tree
Hide file tree
Showing 43 changed files with 102 additions and 117 deletions.
8 changes: 4 additions & 4 deletions Browser/src/ClipboardComponent.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CLASS ClipboardComponent EXTENDS Component MODULE BrowserApp CLASSVARS ''
VARS 'clipboardInput clipboardWriteButton clipboardReadButton clipboardResultLabel'
VARS 'clipboardInput clipboardWriteButton clipboardReadButton clipboardResultParagraph'

htmlPath
^ 'Components/ClipboardComponent.html'.
Expand All @@ -16,17 +16,17 @@ bindElements
clipboardWriteButton := Document getElementById: 'clipboardWriteButton' class: HtmlButtonElement.
clipboardWriteButton onClick: [ self onClipboardWriteButton ].

clipboardResultLabel := Document getElementById: 'clipboardResultLabel' class: HtmlLabelElement.
clipboardResultParagraph := Document getElementById: 'clipboardResultParagraph' class: HtmlParagraphElement.
!
onClipboardReadButton
"Note: This function cannot be GUI tested automatically
because it may require user permission first."
Window default navigator clipboard readTextThen:
[ :text | clipboardResultLabel textContent: text ].
[ :text | clipboardResultParagraph textContent: text ].
!
onClipboardWriteButton
"Note: This function cannot be GUI tested automatically
because it may require user permission first."
Window default navigator clipboard writeText: clipboardInput value then:
[ :text | clipboardResultLabel textContent: '[written]' ].
[ :text | clipboardResultParagraph textContent: '[written]' ].
!
12 changes: 6 additions & 6 deletions Browser/src/CssComponent.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CLASS CssComponent EXTENDS Component MODULE BrowserApp CLASSVARS ''
VARS 'applyButton removeButton resultLabel'
VARS 'applyButton removeButton resultParagraph'

htmlPath
^ 'Components/CssComponent.html'.
Expand All @@ -16,7 +16,7 @@ bindElements
removeButton := Document getElementById: 'cssRemoveButton' class: HtmlButtonElement.
removeButton onClick: [ self onRemove ].

resultLabel := Document getElementById: 'cssResultLabel' class: HtmlLabelElement.
resultParagraph := Document getElementById: 'cssResultParagraph' class: HtmlParagraphElement.

"Check for existence of italicBold style class."
cssStyleSheet := Document default styleSheets first.
Expand All @@ -25,10 +25,10 @@ bindElements
self assert: [ index >= 0 ].
!
onApply
resultLabel classList add: 'italicBold'.
resultParagraph classList add: 'italicBold'.
!
onRemove
resultLabel classList remove: 'italicBold'.
resultParagraph classList remove: 'italicBold'.
!

"Accessing"
Expand All @@ -39,6 +39,6 @@ applyButton
removeButton
^ removeButton.
!
resultLabel
^ resultLabel.
resultParagraph
^ resultParagraph.
!
10 changes: 5 additions & 5 deletions Browser/src/DialogsComponent.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CLASS DialogsComponent EXTENDS Component MODULE BrowserApp CLASSVARS ''
VARS 'alertButton confirmButton promptButton printButton dialogResultLabel'
VARS 'alertButton confirmButton promptButton printButton dialogResultParagraph'

"Note: Testing these dialogs can only be done be done manually in the browser."

Expand All @@ -25,7 +25,7 @@ bindElements
printButton := Document getElementById: 'printButton' class: HtmlButtonElement.
printButton onClick: [ self onPrint ].

dialogResultLabel := Document getElementById: 'dialogResultLabel' class: HtmlLabelElement.
dialogResultParagraph := Document getElementById: 'dialogResultParagraph' class: HtmlParagraphElement.
!
onPopup
"This requires popups to be enabled in the browser."
Expand All @@ -40,17 +40,17 @@ onPopup
!
onAlert
Window default alert: 'My Alert'.
dialogResultLabel textContent: 'Alerted'.
dialogResultParagraph textContent: 'Alerted'.
!
onConfirm
| result |
result := Window default confirm: 'My Confirm'.
dialogResultLabel textContent: result toString.
dialogResultParagraph textContent: result toString.
!
onPrompt
| result |
result := Window default prompt: 'My Prompt'.
dialogResultLabel textContent: result toString.
dialogResultParagraph textContent: result toString.
!
onPrint
Window default print.
Expand Down
10 changes: 5 additions & 5 deletions Browser/src/Input/CheckboxInputComponent.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CLASS CheckboxInputComponent EXTENDS Component MODULE BrowserApp CLASSVARS ''
VARS 'checkboxInput outputLabel'
VARS 'checkboxInput outputParagraph'

htmlPath
^ 'Components/Input/CheckboxInputComponent.html'.
Expand All @@ -9,12 +9,12 @@ start
!
bindElements
checkboxInput := Document getElementById: 'checkboxInput' class: HtmlInputElement.
outputLabel := Document getElementById: 'checkboxInputOutputLabel' class: HtmlLabelElement.
outputParagraph := Document getElementById: 'checkboxInputOutputParagraph' class: HtmlParagraphElement.

checkboxInput onClick: [ self onCheckboxInputClicked ].
!
onCheckboxInputClicked
outputLabel textContent: (
outputParagraph textContent: (
checkboxInput checked ifTrue: [ 'Checked' ] ifFalse: [ 'Unchecked' ] ).
!

Expand All @@ -23,6 +23,6 @@ onCheckboxInputClicked
checkboxInput
^ checkboxInput.
!
outputLabel
^ outputLabel.
outputParagraph
^ outputParagraph.
!
10 changes: 5 additions & 5 deletions Browser/src/Input/DateInputComponent.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CLASS DateInputComponent EXTENDS Component MODULE BrowserApp CLASSVARS ''
VARS 'dateInput outputLabel'
VARS 'dateInput outputParagraph'

htmlPath
^ 'Components/Input/DateInputComponent.html'.
Expand All @@ -9,19 +9,19 @@ start
!
bindElements
dateInput := Document getElementById: 'dateInput' class: HtmlInputElement.
outputLabel := Document getElementById: 'dateInputOutputLabel' class: HtmlLabelElement.
outputParagraph := Document getElementById: 'dateInputOutputParagraph' class: HtmlParagraphElement.

dateInput addEventListener: 'change' then: [ self onDateSelected ].
!
onDateSelected
outputLabel textContent: dateInput value.
outputParagraph textContent: dateInput value.
!

"Accessing"

dateInput
^ dateInput.
!
outputLabel
^ outputLabel.
outputParagraph
^ outputParagraph.
!
10 changes: 5 additions & 5 deletions Browser/src/Input/FileInputComponent.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CLASS FileInputComponent EXTENDS Component MODULE BrowserApp CLASSVARS ''
VARS 'fileInput outputLabel'
VARS 'fileInput outputParagraph'

htmlPath
^ 'Components/Input/FileInputComponent.html'.
Expand All @@ -9,14 +9,14 @@ start
!
bindElements
fileInput := Document getElementById: 'fileInput' class: HtmlInputElement.
outputLabel := Document getElementById: 'fileInputOutputLabel' class: HtmlLabelElement.
outputParagraph := Document getElementById: 'fileInputOutputParagraph' class: HtmlParagraphElement.

fileInput addEventListener: 'change' then: [ self onFileSelected ].
!
onFileSelected
| file |

outputLabel textContent: fileInput value.
outputParagraph textContent: fileInput value.

fileInput files length > 0 ifTrue: [
file := fileInput files first.
Expand All @@ -29,6 +29,6 @@ onFileSelected
fileInput
^ fileInput.
!
outputLabel
^ outputLabel.
outputParagraph
^ outputParagraph.
!
10 changes: 5 additions & 5 deletions Browser/src/Input/ImageInputComponent.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CLASS ImageInputComponent EXTENDS Component MODULE BrowserApp CLASSVARS ''
VARS 'imageInput outputLabel'
VARS 'imageInput outputParagraph'

htmlPath
^ 'Components/Input/ImageInputComponent.html'.
Expand All @@ -9,16 +9,16 @@ start
!
bindElements
imageInput := Document getElementById: 'imageInput' class: HtmlInputElement.
outputLabel := Document getElementById: 'imageInputOutputLabel' class: HtmlLabelElement.
outputParagraph := Document getElementById: 'imageInputOutputParagraph' class: HtmlParagraphElement.

imageInput onClick: [ outputLabel textContent: 'Image clicked' ].
imageInput onClick: [ outputParagraph textContent: 'Image clicked' ].
!

"Accessing"

imageInput
^ imageInput.
!
outputLabel
^ outputLabel.
outputParagraph
^ outputParagraph.
!
10 changes: 5 additions & 5 deletions Browser/src/Input/InputComponent.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CLASS InputComponent EXTENDS Component MODULE BrowserApp CLASSVARS ''
VARS 'input outputButton outputLabel'
VARS 'input outputButton outputParagraph'

htmlPath
^ 'Components/Input/InputComponent.html'.
Expand All @@ -10,9 +10,9 @@ start
bindElements
input := Document getElementById: 'input' class: HtmlInputElement.
outputButton := Document getElementById: 'inputOutputButton' class: HtmlButtonElement.
outputLabel := Document getElementById: 'inputOutputLabel' class: HtmlLabelElement.
outputParagraph := Document getElementById: 'inputOutputParagraph' class: HtmlParagraphElement.

outputButton onClick: [ outputLabel textContent: input value ].
outputButton onClick: [ outputParagraph textContent: input value ].
!

"Accessing"
Expand All @@ -23,6 +23,6 @@ input
outputButton
^ outputButton.
!
outputLabel
^ outputLabel.
outputParagraph
^ outputParagraph.
!
10 changes: 5 additions & 5 deletions Browser/src/Input/ListInputComponent.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CLASS ListInputComponent EXTENDS Component MODULE BrowserApp CLASSVARS ''
VARS 'listInput dataList outputLabel'
VARS 'listInput dataList outputParagraph'

htmlPath
^ 'Components/Input/ListInputComponent.html'.
Expand All @@ -10,10 +10,10 @@ start
bindElements
listInput := Document getElementById: 'listInput' class: HtmlInputElement.
dataList := Document getElementById: 'dataList' class: HtmlDataListElement.
outputLabel := Document getElementById: 'listInputOutputLabel' class: HtmlLabelElement.
outputParagraph := Document getElementById: 'listInputOutputParagraph' class: HtmlParagraphElement.

listInput addEventListener: 'input' then: [
outputLabel textContent: listInput value ].
outputParagraph textContent: listInput value ].
!

"Accessing"
Expand All @@ -24,6 +24,6 @@ listInput
dataList
^ dataList.
!
outputLabel
^ outputLabel.
outputParagraph
^ outputParagraph.
!
12 changes: 6 additions & 6 deletions Browser/src/Input/RadioInputComponent.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CLASS RadioInputComponent EXTENDS Component MODULE BrowserApp CLASSVARS ''
VARS 'radioInput1 radioInput2 outputLabel'
VARS 'radioInput1 radioInput2 outputParagraph'

htmlPath
^ 'Components/Input/RadioInputComponent.html'.
Expand All @@ -10,10 +10,10 @@ start
bindElements
radioInput1 := Document getElementById: 'radioInput1' class: HtmlInputElement.
radioInput2 := Document getElementById: 'radioInput2' class: HtmlInputElement.
outputLabel := Document getElementById: 'radioInputOutputLabel' class: HtmlLabelElement.
outputParagraph := Document getElementById: 'radioInputOutputParagraph' class: HtmlParagraphElement.

radioInput1 onClick: [ outputLabel textContent: 'Radio 1' ].
radioInput2 onClick: [ outputLabel textContent: 'Radio 2' ].
radioInput1 onClick: [ outputParagraph textContent: 'Radio 1' ].
radioInput2 onClick: [ outputParagraph textContent: 'Radio 2' ].
!

"Accessing"
Expand All @@ -24,6 +24,6 @@ radioInput1
radioInput2
^ radioInput2.
!
outputLabel
^ outputLabel.
outputParagraph
^ outputParagraph.
!
2 changes: 1 addition & 1 deletion Browser/src/Input/Test/TestCheckboxInputComponent.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ testGui

checkboxInputComponent checkboxInput click.
Timer timeout: 500 then: [
self assert: [ checkboxInputComponent outputLabel textContent = 'Checked' ] ]."
self assert: [ checkboxInputComponent outputParagraph textContent = 'Checked' ] ]."
!
2 changes: 1 addition & 1 deletion Browser/src/Input/Test/TestImageInputComponent.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ testGui

imageInputComponent imageInput click.
Timer timeout: 500 then: [
self assert: [ imageInputComponent outputLabel textContent = 'Image clicked' ] ]."
self assert: [ imageInputComponent outputParagraph textContent = 'Image clicked' ] ]."
!
2 changes: 1 addition & 1 deletion Browser/src/Input/Test/TestInputComponent.st
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ testGui

inputComponent outputButton click.
Timer timeout: 500 then: [
self assert: [ inputComponent outputLabel textContent = 'My input' ] ].
self assert: [ inputComponent outputParagraph textContent = 'My input' ] ].
!

2 changes: 1 addition & 1 deletion Browser/src/Input/Test/TestListInputCompent.st
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ testGui
listInputComponent listInput value: listInputComponent dataList options last value.
listInputComponent listInput dispatchEvent: ( Event type: 'input' ).
Timer timeout: 500 then: [
self assert: [ listInputComponent outputLabel textContent = 'Second' ] ]."
self assert: [ listInputComponent outputParagraph textContent = 'Second' ] ]."
!
2 changes: 1 addition & 1 deletion Browser/src/Input/Test/TestRadioInputComponent.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ testGui

radioInputComponent radioInput2 click.
Timer timeout: 500 then: [
self assert: [ radioInputComponent outputLabel textContent = 'Radio 2' ] ]."
self assert: [ radioInputComponent outputParagraph textContent = 'Radio 2' ] ]."
!
8 changes: 4 additions & 4 deletions Browser/src/ScriptComponent.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CLASS ScriptComponent EXTENDS Component MODULE BrowserApp CLASSVARS ''
VARS 'script runButton countLabel'
VARS 'script runButton countSpan'

htmlPath
^ 'Components/ScriptComponent.html'.
Expand All @@ -11,7 +11,7 @@ start
bindElements
script := Document getElementById: 'script' class: HtmlScriptElement.
runButton := Document getElementById: 'scriptRunButton' class: HtmlButtonElement.
countLabel := Document getElementById: 'scriptCountLabel' class: HtmlLabelElement.
countSpan := Document getElementById: 'scriptCountSpan' class: HtmlSpanElement.

runButton onClick: [ INLINE 'ScriptFunction()' ].
!
Expand Down Expand Up @@ -39,6 +39,6 @@ script
runButton
^ runButton.
!
countLabel
^ countLabel.
countSpan
^ countSpan.
!
Loading

0 comments on commit 90e8509

Please sign in to comment.