Skip to content

Commit

Permalink
More tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jecisc committed May 25, 2018
1 parent 71e04d0 commit 52449b3
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tests
testSelect
self deny: [ :html | MDLPanelSwitcherButton new renderContentOn: html ] generatedIncludes: 'class="panel-switcher-button__content panel-switcher-selected"'.
self assert: [ :html | MDLPanelSwitcherButton new select; renderContentOn: html ] generatedIncludes: 'class="panel-switcher-button__content panel-switcher-selected"'
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
tests
testAddAllButtons
| toolbar |
toolbar := MDLVerticalToolbar new.
self assert: toolbar buttons size equals: 0.
toolbar
addAllButtons:
{(MDLFoldButton for: '#id').
MDLPanelSwitcherButton new}.
self assert: toolbar buttons size equals: 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tests
testAddButton
| toolbar |
toolbar := MDLVerticalToolbar new.
self assert: toolbar buttons size equals: 0.
toolbar addButton: (MDLFoldButton for: '#id').
self assert: toolbar buttons size equals: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
tests
testChildren
| toolbar buttons |
toolbar := MDLVerticalToolbar new.
buttons := {(MDLFoldButton for: '#id').
MDLPanelSwitcherButton new}.
toolbar addAllButtons: buttons.
self assertCollection: toolbar children hasSameElements: buttons
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
tests
testRendering
self
assert: [ :html |
html
render:
(MDLVerticalToolbar
buttons:
{(MDLFoldButton for: '#id').
MDLPanelSwitcherButton new}) ]
generatedIncludes: 'class="vertical-toolbar"'
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
tests
testResetButtonsSelection
| toolbar buttons |
toolbar := MDLVerticalToolbar new.
buttons := {(MDLFoldButton for: '#id').
(MDLPanelSwitcherButton new
select;
yourself)}.
toolbar addAllButtons: buttons.
self assert: (toolbar children anySatisfy: #isSelected).
toolbar resetButtonsSelection.
self deny: (toolbar children anySatisfy: #isSelected)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "",
"super" : "MDLAbstractSeasideTestCase",
"category" : "Material-Design-Lite-Extensions-Tests-Panels",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "MDLVerticalToolbarTest",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
isSelected
"To be polymorphic with MDLPanelSwitcherButton"

^ false
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
initialization
initialize
super initialize.
self isSelected: false
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
accessing
isSelected
^ isSelected ifNil: [ isSelected := false ]
^ isSelected
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
rendering
renderContentOn: html
html div
class: #'panel-switcher-button';
class: 'panel-switcher-button';
id: self id;
with: [ html div
id: html nextId;
class: #'panel-switcher-button__content';
class: #'panel-switcher-selected' if: self isSelected;
class: 'panel-switcher-button__content';
class: 'panel-switcher-selected' if: self isSelected;
onClick:
'$(".panel-switcher-selected").removeClass("panel-switcher-selected"); $(this).addClass("panel-switcher-selected")'
js
,
((html jQuery id: self panelId) load
html: [ :r |
self owner resetButtonSelection.
self owner resetButtonsSelection.
self select.
self actionBlock value: r ];
onComplete: self onCompleteJs);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
rendering
renderContentOn: html
html div
class: #'vertical-toolbar';
class: 'vertical-toolbar';
with: [
self buttons
do: [ :button |
html div
class: #'vertical-toolbar__button';
class: 'vertical-toolbar__button';
with: [ html render: button ] ] ]

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
action
resetButtonsSelection
self buttons do: [ :each | each isSelected: false ]

0 comments on commit 52449b3

Please sign in to comment.