-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4465 from Tyriar/4410
Ensure Decoration.isDisposed can be true
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Copyright (c) 2019 The xterm.js authors. All rights reserved. | ||
* @license MIT | ||
*/ | ||
|
||
import { assert } from 'chai'; | ||
import { DecorationService } from './DecorationService'; | ||
import { EventEmitter } from 'common/EventEmitter'; | ||
import { IMarker } from 'common/Types'; | ||
import { Disposable } from 'common/Lifecycle'; | ||
|
||
const fakeMarker: IMarker = Object.freeze(new class extends Disposable { | ||
public readonly id = 1; | ||
public readonly line = 1; | ||
public readonly isDisposed = false; | ||
public readonly onDispose = new EventEmitter<void>().event; | ||
}()); | ||
|
||
describe('DecorationService', () => { | ||
it('should set isDisposed to true after dispose', () => { | ||
const service = new DecorationService(); | ||
const decoration = service.registerDecoration({ | ||
marker: fakeMarker | ||
}); | ||
assert.ok(decoration); | ||
assert.isFalse(decoration!.isDisposed); | ||
decoration!.dispose(); | ||
assert.isTrue(decoration!.isDisposed); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters