Skip to content

Commit dcb670d

Browse files
committed
Cleaning cleaning cleaning a bit more.
- remove file - initialize a default fileReference - remove syntaxState - renamed instance variable - remove unless tests Should do a pass on test and clean more.
1 parent c4f1a75 commit dcb670d

File tree

5 files changed

+15
-49
lines changed

5 files changed

+15
-49
lines changed

src/MicroEd-Spec-Tests/MDEditorFilePresenterTest.class.st

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,6 @@ MDEditorFilePresenterTest >> testGotMicrodownParser [
6969
self assert: presenter microdownParser class equals: MicrodownParser
7070
]
7171

72-
{ #category : 'running' }
73-
MDEditorFilePresenterTest >> testMDFileOverwriteFileReferenceWhenAnotherSameFile [
74-
75-
"We want to test how to overwrite the content of a file when there is another file with the same name. "
76-
self skip.
77-
]
78-
7972
{ #category : 'tests-interaction' }
8073
MDEditorFilePresenterTest >> testOpenIsWorkingSmokeTest [
8174

src/MicroEd-Spec/MDEditorPresenter.class.st

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Class {
1111
#superclass : 'SpApplicationWithToolbar',
1212
#instVars : [
1313
'textInput',
14-
'textOutput',
1514
'composer',
1615
'syntaxState',
17-
'mdFile'
16+
'mdFile',
17+
'renderedText'
1818
],
1919
#category : 'MicroEd-Spec',
2020
#package : 'MicroEd-Spec'
@@ -49,7 +49,7 @@ MDEditorPresenter >> cleanInput [
4949
{ #category : 'actions' }
5050
MDEditorPresenter >> cleanOutput [
5151

52-
textOutput text: ''
52+
renderedText text: ''
5353
]
5454

5555
{ #category : 'layout' }
@@ -58,8 +58,8 @@ MDEditorPresenter >> defaultLayout [
5858
^ SpBoxLayout newTopToBottom
5959
add: #menu expand: false;
6060
add: (SpPanedLayout newLeftToRight
61-
add: #textInput;
62-
add: #textOutput;
61+
add: textInput;
62+
add: renderedText;
6363
yourself);
6464
yourself
6565
]
@@ -185,7 +185,7 @@ MDEditorPresenter >> initializePresentersWithText: anInputText [
185185
[ self application defer: [ self renderAction ] ] schedule.
186186
anEvent wasHandled: false ]."
187187

188-
textOutput := self newText
188+
renderedText := self newText
189189
beNotEditable;
190190
yourself
191191

@@ -228,7 +228,6 @@ MDEditorPresenter >> openFile [
228228
openModal.
229229
selectedFile
230230
ifNotNil: [
231-
232231
self mdFile: (MDFile newFromFileReference: selectedFile asFileReference).
233232
textInput text: selectedFile contents.
234233
self cleanOutput.
@@ -246,7 +245,7 @@ MDEditorPresenter >> renderDocument [
246245
document := syntaxState parse: textInput text.
247246
text := composer visit: document.
248247

249-
textOutput text: text.
248+
renderedText text: text.
250249

251250
]
252251

@@ -263,7 +262,7 @@ MDEditorPresenter >> saveFile [
263262
MDEditorPresenter >> setExampleAsInput [
264263
"GET EXAMPLE button is pressed: fill input text with an example"
265264

266-
textInput text: syntaxState exampleText.
265+
textInput text: self exampleText.
267266
self cleanOutput
268267
]
269268

@@ -276,18 +275,6 @@ MDEditorPresenter >> startNewFile [
276275
self window ifNotNil: [ self updateTitle ]
277276
]
278277

279-
{ #category : 'accessing' }
280-
MDEditorPresenter >> syntaxState [
281-
282-
^ syntaxState
283-
]
284-
285-
{ #category : 'accessing' }
286-
MDEditorPresenter >> syntaxState: aSyntaxState [
287-
288-
syntaxState := aSyntaxState
289-
]
290-
291278
{ #category : 'accessing' }
292279
MDEditorPresenter >> textInputText [
293280

@@ -303,7 +290,7 @@ MDEditorPresenter >> textInputText: aString [
303290
{ #category : 'accessing' }
304291
MDEditorPresenter >> textOutputText [
305292

306-
^ textOutput text
293+
^ renderedText text
307294
]
308295

309296
{ #category : 'api' }

src/MicroEd-Tests/MDFileTest.class.st

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ MDFileTest >> testMDFileHasFileReferenceWithFormatISO [
134134

135135
| file date |
136136
file := MDFile newFromFileReference: fileReferenceWithName.
137-
date := DateAndTime now asDate yyyymmdd.
137+
date := Date today yyyymmdd.
138138
self assert: (file basename includesSubstring: date).
139-
self deny: (fileReferenceWithName exists )
139+
self deny: fileReferenceWithName exists
140140
]
141141

142142
{ #category : 'tests' }

src/MicroEd-Tests/MDMicroDownSyntaxTest.class.st

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/MicroEd/MDFile.class.st

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ MDFile >> contents [
6969
{ #category : 'accessing' }
7070
MDFile >> contents: aContent [
7171

72-
fileReference contents: aContent
72+
fileReference writeStreamDo: [ :stream |
73+
stream nextPutAll: aContent ]
7374
]
7475

7576
{ #category : 'testing' }
@@ -90,16 +91,10 @@ MDFile >> extension: anExtension [
9091
fileReference extension: anExtension
9192
]
9293

93-
{ #category : 'accessing' }
94-
MDFile >> file [
95-
96-
^ fileReference
97-
]
98-
9994
{ #category : 'accessing' }
10095
MDFile >> fileReference [
10196

102-
^ fileReference
97+
^ fileReference ifNil: [ fileReference := 'unnamed.md' asFileReference ]
10398
]
10499

105100
{ #category : 'accessing' }
@@ -134,7 +129,7 @@ MDFile >> initializeWithFileReference: aFileReference [
134129
{ #category : 'accessing' }
135130
MDFile >> save: aString [
136131

137-
fileReference asFileReference writeStreamDo: [ :str |
132+
fileReference writeStreamDo: [ :str |
138133
str nextPutAll: aString ].
139134

140135

0 commit comments

Comments
 (0)