forked from gcotelli/RenoirSt
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add #setInlineStyleTo: to canvas brushes
- Loading branch information
Showing
4 changed files
with
72 additions
and
32 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
source/RenoirSt-Seaside-Tests/CssDeclarationBlockInSeasideTest.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Class { | ||
#name : #CssDeclarationBlockInSeasideTest, | ||
#superclass : #TestCase, | ||
#category : #'RenoirSt-Seaside-Tests' | ||
} | ||
|
||
{ #category : #Tests } | ||
CssDeclarationBlockInSeasideTest >> testGreaseStringOnDeclarationBlock [ | ||
|
||
| declarationBlock | | ||
declarationBlock := CssDeclarationBlock new | ||
margin: 2 px; | ||
border: 1 cm; | ||
yourself. | ||
|
||
self assert: declarationBlock greaseString equals: 'margin: 2px;border: 1cm;' | ||
] | ||
|
||
{ #category : #Tests } | ||
CssDeclarationBlockInSeasideTest >> testInlineStyleRendering [ | ||
|
||
| builder | | ||
|
||
builder := WAHtmlCanvas builder | ||
fullDocument: false; | ||
yourself. | ||
|
||
self | ||
assert: (builder render: [ :html | html div setInlineStyleTo: [ :style | style margin: 1 px ] ]) | ||
equals: '<div style="margin: 1px;"></div>'; | ||
assert: | ||
(builder | ||
render: [ :html | | ||
html div | ||
setInlineStyleTo: [ :style :constants | | ||
style | ||
margin: constants >> #auto; | ||
color: constants >> #colors >> #blue ] ]) | ||
equals: '<div style="margin: auto;color: blue;"></div>' | ||
] | ||
|
||
{ #category : #Tests } | ||
CssDeclarationBlockInSeasideTest >> testJavascriptOnDeclarationBlock [ | ||
|
||
| declarationBlock | | ||
declarationBlock := CssDeclarationBlock new | ||
margin: 2 px; | ||
border: 1 cm; | ||
yourself. | ||
|
||
self | ||
assert: (String streamContents: [ :stream | declarationBlock javascriptOn: stream ]) | ||
equals: '{"margin":"2px","border":"1cm"}' | ||
] |
31 changes: 0 additions & 31 deletions
31
source/RenoirSt-Seaside-Tests/CssDeclarationBlockJavascriptTest.class.st
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Extension { #name : #WATagBrush } | ||
|
||
{ #category : #'*RenoirSt-Seaside' } | ||
WATagBrush >> setInlineStyleTo: aDeclarationAction [ | ||
|
||
| declarationBlock | | ||
|
||
declarationBlock := CssDeclarationBlock new. | ||
aDeclarationAction cull: declarationBlock cull: RenoirSt constants. | ||
self style: declarationBlock | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters