Skip to content

Commit

Permalink
Add toggle state and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
westphal-jan committed Jun 15, 2018
1 parent b5d0651 commit cb8980d
Show file tree
Hide file tree
Showing 23 changed files with 101 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default properties
backgroundColorToggled

^ '185,185,185'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
drawing
checkToggled

(self isEnabled and: [self isToggled]) ifTrue: [
self currentBackgroundColor: self class backgroundColorToggled]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
event handling
disable

self label color: self textColorDisabled.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
drawing
drawOn: aCanvas

self checkToggled.
super drawOn: aCanvas.
self updateContents: aCanvas
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
event handling
enable

self label color: self textColor.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
isToggled

^ self properties at: #toggled ifAbsent: [ ^ self toggled: false ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
event handling
toggleOff

self toggled: false.
self calculateColor
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
event handling
toggleOn

self isDisabled ifTrue: [^ false].
self toggled: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
toggled: aBoolean

^ self setProperty: #toggled to: aBoolean
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"class" : {
"alwaysUppercase" : "JW 6/8/2018 16:04",
"backgroundColorToggled" : "JW 6/15/2018 12:56",
"defaultBorderRadius" : "LS 5/14/2018 10:01",
"defaultElevatedSizeDifference" : "mats 5/22/2018 11:09",
"defaultHeight" : "JW 5/17/2018 13:01",
Expand All @@ -19,9 +20,10 @@
"calculateTextColor" : "JW 5/23/2018 15:40",
"calculateWidth" : "JW 5/27/2018 11:47",
"calculateWidthByText" : "LS 6/12/2018 09:12",
"checkToggled" : "JW 6/15/2018 12:45",
"decreaseSize" : "mats 5/22/2018 11:06",
"disable" : "JW 6/8/2018 15:07",
"drawOn:" : "LS 6/12/2018 16:51",
"drawOn:" : "JW 6/15/2018 12:46",
"drop" : "LS 5/7/2018 20:23",
"elevate" : "LS 5/7/2018 20:22",
"elevatedSizeDifference" : "LS 5/14/2018 09:57",
Expand All @@ -38,6 +40,7 @@
"increaseSize" : "mats 5/22/2018 11:11",
"initialize" : "JW 6/8/2018 16:03",
"initializeLabel" : "JW 6/8/2018 16:04",
"isToggled" : "JW 6/15/2018 12:22",
"label" : "JW 6/8/2018 15:11",
"label:" : "JW 6/8/2018 15:11",
"labelPositionIconNotPresent" : "LS 6/12/2018 20:14",
Expand All @@ -49,6 +52,9 @@
"textColor:" : "JW 6/8/2018 15:24",
"textColorDisabled" : "JW 5/23/2018 16:26",
"textProperty:" : "LS 6/5/2018 17:43",
"toggleOff" : "JW 6/15/2018 12:39",
"toggleOn" : "JW 6/15/2018 12:41",
"toggled:" : "JW 6/15/2018 12:34",
"updateBounds" : "LS 6/10/2018 17:48",
"updateContents:" : "LS 6/12/2018 20:11",
"updateIcon" : "LS 6/10/2018 17:42",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"instvars" : [
"ripples",
"isMouseDown",
"isHovered",
"wantsRipples",
"wantsStates",
"negatedShapeCache",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"borderRadius" : "mats 5/25/2018 23:31",
"bounds" : "LS 6/12/2018 09:23",
"disable" : "LS 5/28/2018 21:33",
"drawOn:" : "mats 5/29/2018 16:01",
"drawOn:" : "JW 6/15/2018 12:57",
"enable" : "LS 5/28/2018 21:33",
"iconPosition" : "LS 6/10/2018 17:46",
"initialize" : "Max 5/23/2018 12:01",
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
testing
testToggled

self testToggled: self classToTest new

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
testToggledOnAndOff

self testToggledOnAndOff: self classToTest new
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
"disabled" : "mats 6/13/2018 10:33",
"enabled" : "mats 6/13/2018 10:33",
"mouseEntered" : "mats 6/13/2018 11:24",
"tests" : "mats 6/13/2018 10:28" },
"tests" : "mats 6/13/2018 10:28",
"toggled" : "JW 6/15/2018 13:06" },
"instance" : {
"testAlternativeText" : "JW 6/11/2018 22:24",
"testDisable" : "JW 6/11/2018 22:24",
"testDisableAndEnable" : "JW 6/11/2018 22:24",
"testEnabled" : "JW 6/11/2018 22:24",
"testMouseEnter" : "JW 6/11/2018 23:11",
"testMouseEnterAndLeave" : "JW 6/11/2018 23:13" } }
"testMouseEnterAndLeave" : "JW 6/11/2018 23:13",
"testToggled" : "JW 6/15/2018 13:11",
"testToggledOnAndOff" : "JW 6/15/2018 13:11" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
testing
testToggled: aMDWidget

aMDWidget toggleOn.
self testEquality: aMDWidget with: self class toggled


Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
testing
testToggledOnAndOff: aMDWidget

aMDWidget toggleOn.
aMDWidget toggleOff.
self testEquality: aMDWidget with: self class enabled




Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@
"testEnabled:" : "JW 6/11/2018 22:16",
"testEquality:with:" : "mats 6/13/2018 09:44",
"testMouseEnter:" : "mats 6/13/2018 10:03",
"testMouseEnterAndLeave:" : "mats 6/13/2018 10:30" } }
"testMouseEnterAndLeave:" : "mats 6/13/2018 10:30",
"testToggled:" : "JW 6/15/2018 13:09",
"testToggledOnAndOff:" : "JW 6/15/2018 13:10" } }

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
testToggled

self testToggled: self classToTest new
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
testToggledOnAndOff

self testToggledOnAndOff: self classToTest new
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
"disabled" : "mats 6/13/2018 10:34",
"enabled" : "mats 6/13/2018 10:34",
"mouseEntered" : "mats 6/13/2018 10:28",
"tests" : "mats 6/13/2018 10:28" },
"tests" : "mats 6/13/2018 10:28",
"toggled" : "JW 6/15/2018 13:07" },
"instance" : {
"testAlternativeText" : "JW 6/11/2018 22:25",
"testDisable" : "JW 6/11/2018 22:26",
"testDisableAndEnable" : "JW 6/11/2018 22:26",
"testEnabled" : "JW 6/11/2018 22:26",
"testMouseEnter" : "JW 6/11/2018 23:12",
"testMouseEnterAndLeave" : "JW 6/11/2018 23:13" } }
"testMouseEnterAndLeave" : "JW 6/11/2018 23:13",
"testToggled" : "JW 6/15/2018 13:11",
"testToggledOnAndOff" : "JW 6/15/2018 13:11" } }

0 comments on commit cb8980d

Please sign in to comment.