Skip to content

Commit

Permalink
add actionMofifier idiom
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanlm committed Sep 30, 2023
1 parent 074b71c commit 9d2ea02
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Spec2-Core/Character.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Extension { #name : #Character }

{ #category : #'*Spec2-Core' }
Character >> actionModifier [
"Define the action action modifier depending in which platform we are running.
e.g. $x actionModifier will resolve in $x ctrl in unix and windows systems and $x command
in mac"

^ self asKeyCombination actionModifier
]
12 changes: 12 additions & 0 deletions src/Spec2-Core/KMKeyCombination.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Extension { #name : #KMKeyCombination }

{ #category : #'*Spec2-Core' }
KMKeyCombination >> actionModifier [
"Define the action action modifier depending in which platform we are running.
e.g. $x actionModifier will resolve in $x ctrl in unix and windows systems and $x command
in mac"

^ (KMModifier command + self) mac
| (KMModifier control + self) unix
| (KMModifier control + self) win
]
13 changes: 13 additions & 0 deletions src/Spec2-Tests/SpActionModifierTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Class {
#name : #SpActionModifierTest,
#superclass : #TestCase,
#category : #'Spec2-Tests-Core'
}

{ #category : #tests }
SpActionModifierTest >> testActionModifier [

self
assert: $x actionModifier
equals: ($x ctrl unix | $x ctrl win | $x command mac)
]

0 comments on commit 9d2ea02

Please sign in to comment.