Skip to content

Commit

Permalink
Merge pull request #11 from hernanmd/master
Browse files Browse the repository at this point in the history
Update for Pharo 12
  • Loading branch information
Ducasse authored Mar 13, 2024
2 parents 6b56f20 + b1e7e3e commit 0135078
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 138 deletions.
13 changes: 5 additions & 8 deletions src/BaselineOfMicroEd/BaselineOfMicroEd.class.st
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Class {
#name : #BaselineOfMicroEd,
#superclass : #BaselineOf,
#category : #BaselineOfMicroEd
#name : 'BaselineOfMicroEd',
#superclass : 'BaselineOf',
#category : 'BaselineOfMicroEd',
#package : 'BaselineOfMicroEd'
}

{ #category : #baselines }
{ #category : 'baselines' }
BaselineOfMicroEd >> baseline: spec [
<baseline>

Expand All @@ -13,10 +14,6 @@ BaselineOfMicroEd >> baseline: spec [
spec baseline: ''Microdown'' with: [
spec repository: ''github://pillar-markup/Microdown/src'' ]"

spec
baseline: 'FileDialog'
with: [ spec repository: 'github://Ducasse/file-dialog/repository' ].

spec
package: 'MicroEd'
with: [ spec requires: #('FileDialog' ) ].
Expand Down
2 changes: 1 addition & 1 deletion src/BaselineOfMicroEd/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #BaselineOfMicroEd }
Package { #name : 'BaselineOfMicroEd' }
11 changes: 6 additions & 5 deletions src/MicroEd-Tests/MDEditorFileTest.class.st
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
Class {
#name : #MDEditorFileTest,
#superclass : #TestCase,
#category : #'MicroEd-Tests'
#name : 'MDEditorFileTest',
#superclass : 'TestCase',
#category : 'MicroEd-Tests',
#package : 'MicroEd-Tests'
}

{ #category : #tests }
{ #category : 'tests' }
MDEditorFileTest >> testGotFileWhenIsNotSpecify [
| editor |
editor := MDEditorFile new.
self assert: editor file isNil
]

{ #category : #tests }
{ #category : 'tests' }
MDEditorFileTest >> testGotFileWhenIsSpecify [
| editor file |
editor := MDEditorFile new.
Expand Down
22 changes: 15 additions & 7 deletions src/MicroEd-Tests/MDEditorNewFileTest.class.st
Original file line number Diff line number Diff line change
@@ -1,34 +1,42 @@
Class {
#name : #MDEditorNewFileTest,
#superclass : #MDEditorFileTest,
#category : #'MicroEd-Tests'
#name : 'MDEditorNewFileTest',
#superclass : 'MDEditorFileTest',
#instVars : [
'window'
],
#category : 'MicroEd-Tests',
#package : 'MicroEd-Tests'
}

{ #category : #tests }
{ #category : 'tests' }
MDEditorNewFileTest >> testBasename [
| editor |
editor := MDEditorNewFile new.
self assert: editor basename equals: 'newFile'
]

{ #category : #tests }
{ #category : 'tests' }
MDEditorNewFileTest >> testFullname [
| editor |
editor := MDEditorNewFile new.
self assert: editor fullName equals: 'New File has no fullname'
]

{ #category : #tests }
{ #category : 'tests' }
MDEditorNewFileTest >> testIsNew [
| editor |
editor := MDEditorNewFile new.
self assert: editor isNew
]

{ #category : #tests }
{ #category : 'tests' }
MDEditorNewFileTest >> testSaveWithExtension [
| editor text openFile |
"add code to click on save"

self flag: 'How to send a performAction to a button in a modal dialog?'.
^ self skip.

editor := MDEditorNewFile new.
text := SpTextPresenter new.
text text: 'this is a test'.
Expand Down
15 changes: 8 additions & 7 deletions src/MicroEd-Tests/MDEditorOpenedFileTest.class.st
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Class {
#name : #MDEditorOpenedFileTest,
#superclass : #MDEditorFileTest,
#category : #'MicroEd-Tests'
#name : 'MDEditorOpenedFileTest',
#superclass : 'MDEditorFileTest',
#category : 'MicroEd-Tests',
#package : 'MicroEd-Tests'
}

{ #category : #tests }
{ #category : 'tests' }
MDEditorOpenedFileTest >> testBasename [
| editor file |
editor := MDEditorOpenedFile new.
Expand All @@ -14,7 +15,7 @@ MDEditorOpenedFileTest >> testBasename [
self assert: editor basename equals: file basename
]

{ #category : #tests }
{ #category : 'tests' }
MDEditorOpenedFileTest >> testFullname [
| editor file |
editor := MDEditorOpenedFile new.
Expand All @@ -24,14 +25,14 @@ MDEditorOpenedFileTest >> testFullname [
self assert: editor fullName equals: file fullName
]

{ #category : #tests }
{ #category : 'tests' }
MDEditorOpenedFileTest >> testIsNew [
| editor |
editor := MDEditorOpenedFile new.
self assert: editor isNew not
]

{ #category : #tests }
{ #category : 'tests' }
MDEditorOpenedFileTest >> testSaveWithExtension [
| editor file text |
editor := MDEditorOpenedFile new.
Expand Down
29 changes: 15 additions & 14 deletions src/MicroEd-Tests/MDEditorPresenterTest.class.st
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
Class {
#name : #MDEditorPresenterTest,
#superclass : #TestCase,
#name : 'MDEditorPresenterTest',
#superclass : 'TestCase',
#instVars : [
'window'
],
#category : #'MicroEd-Tests'
#category : 'MicroEd-Tests',
#package : 'MicroEd-Tests'
}

{ #category : #running }
{ #category : 'running' }
MDEditorPresenterTest >> tearDown [

window ifNotNil: [ window close ].
super tearDown.
]

{ #category : #tests }
{ #category : 'tests' }
MDEditorPresenterTest >> testCleanAction [
| presenter |
presenter := MDEditorPresenter new.
Expand All @@ -23,55 +24,55 @@ MDEditorPresenterTest >> testCleanAction [
self assert: presenter textOutputText equals: ''
]

{ #category : #tests }
{ #category : 'tests' }
MDEditorPresenterTest >> testGotCurrentFileWhenIsNotSpecify [
| presenter |
presenter := MDEditorPresenter new.
self assert: presenter currentFileState class equals: MDEditorNewFile
]

{ #category : #tests }
{ #category : 'tests' }
MDEditorPresenterTest >> testGotCurrentFileWhenIsSpecify [
| presenter |
presenter := MDEditorPresenter new.
presenter currentFileState: MDEditorOpenedFile new.
self assert: presenter currentFileState class equals: MDEditorOpenedFile
]

{ #category : #tests }
{ #category : 'tests' }
MDEditorPresenterTest >> testGotMicrodownParser [
| browser |
browser := MDEditorPresenter new.
self assert: browser microdownParser class equals: MicroDownParser
self assert: browser microdownParser class equals: MicrodownParser
]

{ #category : #tests }
{ #category : 'tests' }
MDEditorPresenterTest >> testGotSyntaxStateWhenIsNotSpecify [
| presenter |
presenter := MDEditorPresenter new.
presenter syntaxState: MDMicroDownSyntax new.
self assert: presenter syntaxState class equals: MDMicroDownSyntax
]

{ #category : #'tests-interaction' }
{ #category : 'tests-interaction' }
MDEditorPresenterTest >> testOpenIsWorkingSmokeTest [

| browser |
browser := MDEditorPresenter new.
window := browser openWithSpec.
window := browser open.
self tearDown


]

{ #category : #tests }
{ #category : 'tests' }
MDEditorPresenterTest >> testTextInputTextIsNotSpecify [
| presenter |
presenter := MDEditorPresenter new.
self assert: presenter textInputText equals: '% Type your marked-up text here. Render it and see right the output generated as rich text', String cr, String cr, presenter syntaxState exampleText
]

{ #category : #tests }
{ #category : 'tests' }
MDEditorPresenterTest >> testTextInputTextIsSpecify [
| presenter |
presenter := MDEditorPresenter new.
Expand Down
15 changes: 8 additions & 7 deletions src/MicroEd-Tests/MDMicroDownSyntaxTest.class.st
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
Class {
#name : #MDMicroDownSyntaxTest,
#superclass : #TestCase,
#name : 'MDMicroDownSyntaxTest',
#superclass : 'TestCase',
#instVars : [
'syntax'
],
#category : #'MicroEd-Tests'
#category : 'MicroEd-Tests',
#package : 'MicroEd-Tests'
}

{ #category : #tests }
{ #category : 'tests' }
MDMicroDownSyntaxTest >> testGotExtensionWhenIsNotSpecify [

syntax := MDMicroDownSyntax new.
self assert: syntax extension equals: 'mic'
]

{ #category : #tests }
{ #category : 'tests' }
MDMicroDownSyntaxTest >> testGotNameWhenIsNotSpecify [

syntax := MDMicroDownSyntax new.
self assert: syntax name equals: 'MicroDown'
]

{ #category : #tests }
{ #category : 'tests' }
MDMicroDownSyntaxTest >> testGotParserWhenIsNotSpecify [

syntax := MDMicroDownSyntax new.
self assert: syntax parser equals: MicroDownParser
self assert: syntax parser equals: MicrodownParser
]
2 changes: 1 addition & 1 deletion src/MicroEd-Tests/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #'MicroEd-Tests' }
Package { #name : 'MicroEd-Tests' }
19 changes: 10 additions & 9 deletions src/MicroEd/MDEditorFile.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,46 @@ I am the status of an editor respect to it's document.
My subclasses distinguish between a **new** text file and an existing **opened** text file.
"
Class {
#name : #MDEditorFile,
#superclass : #Object,
#name : 'MDEditorFile',
#superclass : 'Object',
#instVars : [
'file'
],
#category : #MicroEd
#category : 'MicroEd',
#package : 'MicroEd'
}

{ #category : #accessing }
{ #category : 'accessing' }
MDEditorFile >> basename [

self subclassResponsibility
]

{ #category : #accessing }
{ #category : 'accessing' }
MDEditorFile >> file [

^ file
]

{ #category : #accessing }
{ #category : 'accessing' }
MDEditorFile >> file: aFile [

file := aFile
]

{ #category : #accessing }
{ #category : 'accessing' }
MDEditorFile >> fullName [

self subclassResponsibility
]

{ #category : #testing }
{ #category : 'testing' }
MDEditorFile >> isNew [

self subclassResponsibility
]

{ #category : #action }
{ #category : 'action' }
MDEditorFile >> save: aText withExtension: anExtension [

^ self subclassResponsibility
Expand Down
28 changes: 15 additions & 13 deletions src/MicroEd/MDEditorNewFile.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,41 @@
I am an editor ""potential"" file, i.e. a file that actually still wasn't written to filesystem.
"
Class {
#name : #MDEditorNewFile,
#superclass : #MDEditorFile,
#category : #MicroEd
#name : 'MDEditorNewFile',
#superclass : 'MDEditorFile',
#category : 'MicroEd',
#package : 'MicroEd'
}

{ #category : #accessing }
{ #category : 'accessing' }
MDEditorNewFile >> basename [

^ 'newFile'
]

{ #category : #accessing }
{ #category : 'accessing' }
MDEditorNewFile >> fullName [

^ 'New File has no fullname'
]

{ #category : #testing }
{ #category : 'testing' }
MDEditorNewFile >> isNew [

^ true
]

{ #category : #action }
{ #category : 'action' }
MDEditorNewFile >> save: aText withExtension: anExtension [

| selectedFile |
selectedFile := FDSaveFileDialog new
defaultName: 'mydocument.' , anExtension asString;
openModal.
selectedFile ifNotNil: [
file := StSaveFilePresenter new
title: 'Save Microdown document';
nameText: 'mydocument.' , anExtension asString;
extensions: { anExtension };
openModal.
file ifNotNil: [
^ MDEditorOpenedFile new
file: selectedFile;
file: file;
save: aText withExtension: anExtension;
yourself ].
^ self
Expand Down
Loading

0 comments on commit 0135078

Please sign in to comment.