File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
CodeEditTests/Features/Editor Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ //
2+ // UndoManagerRegistrationTests.swift
3+ // CodeEditTests
4+ //
5+ // Created by Khan Winter on 7/3/25.
6+ //
7+
8+ @testable import CodeEdit
9+ import Testing
10+ import Foundation
11+ import CodeEditTextView
12+
13+ @Suite
14+ struct UndoManagerRegistrationTests {
15+ let registrar = UndoManagerRegistration ( )
16+ let file = CEWorkspaceFile ( url: URL ( filePath: " /fake/dir/file.txt " ) )
17+ let textView = TextView ( string: " hello world " )
18+
19+ @Test
20+ func newUndoManager( ) {
21+ let manager = registrar. manager ( forFile: file)
22+ #expect( manager. canUndo == false )
23+ }
24+
25+ @Test
26+ func undoManagersRetained( ) throws {
27+ let manager = registrar. manager ( forFile: file)
28+ textView. setUndoManager ( manager)
29+ manager. registerMutation ( . init( insert: " hello " , at: 0 , limit: 11 ) )
30+
31+ let sameManager = registrar. manager ( forFile: file)
32+ #expect( manager === sameManager)
33+ #expect( sameManager. canUndo)
34+ }
35+ }
You can’t perform that action at this time.
0 commit comments