File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright (c) 2019 The xterm.js authors. All rights reserved.
3+ * @license MIT
4+ */
5+
6+ import { assert } from 'chai' ;
7+ import { DecorationService } from './DecorationService' ;
8+ import { EventEmitter } from 'common/EventEmitter' ;
9+ import { IMarker } from 'common/Types' ;
10+ import { Disposable } from 'common/Lifecycle' ;
11+
12+ const fakeMarker : IMarker = Object . freeze ( new class extends Disposable {
13+ public readonly id = 1 ;
14+ public readonly line = 1 ;
15+ public readonly isDisposed = false ;
16+ public readonly onDispose = new EventEmitter < void > ( ) . event ;
17+ } ( ) ) ;
18+
19+ describe ( 'DecorationService' , ( ) => {
20+ it ( 'should set isDisposed to true after dispose' , ( ) => {
21+ const service = new DecorationService ( ) ;
22+ const decoration = service . registerDecoration ( {
23+ marker : fakeMarker
24+ } ) ;
25+ assert . ok ( decoration ) ;
26+ assert . isFalse ( decoration ! . isDisposed ) ;
27+ decoration ! . dispose ( ) ;
28+ assert . isTrue ( decoration ! . isDisposed ) ;
29+ } ) ;
30+ } ) ;
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ export class DecorationService extends Disposable implements IDecorationService
104104class Decoration extends Disposable implements IInternalDecoration {
105105 public readonly marker : IMarker ;
106106 public element : HTMLElement | undefined ;
107- public isDisposed : boolean = false ;
107+ public get isDisposed ( ) : boolean { return this . _isDisposed ; }
108108
109109 public readonly onRenderEmitter = this . register ( new EventEmitter < HTMLElement > ( ) ) ;
110110 public readonly onRender = this . onRenderEmitter . event ;
You can’t perform that action at this time.
0 commit comments