forked from pixijs-userland/html-text
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18b4fd7
commit 1a98850
Showing
3 changed files
with
73 additions
and
7 deletions.
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
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
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,46 @@ | ||
import { HTMLText } from '../src/HTMLText'; | ||
|
||
describe('HTMLText', () => | ||
{ | ||
it('should create an HTMLText element', () => | ||
{ | ||
const text = new HTMLText('Hello World'); | ||
|
||
expect(text).toBeTruthy(); | ||
expect(text.text).toBe('Hello World'); | ||
|
||
text.destroy(); | ||
}); | ||
|
||
it('should clean up the shadow element', () => | ||
{ | ||
const query = '[data-pixi-html-text]'; | ||
|
||
expect(document.querySelector(query)).toBeFalsy(); | ||
|
||
const text = new HTMLText('Hello world!'); | ||
|
||
expect(document.querySelector(query)).toBeTruthy(); | ||
|
||
text.destroy(); | ||
|
||
expect(document.querySelector(query)).toBeFalsy(); | ||
}); | ||
|
||
it('should clean up the shadow element multiples', () => | ||
{ | ||
const query = '[data-pixi-html-text]'; | ||
|
||
expect(document.querySelector(query)).toBeFalsy(); | ||
|
||
const text = new HTMLText('Hello world!'); | ||
const text2 = new HTMLText('Hello world2!'); | ||
|
||
expect(document.querySelector(query)).toBeTruthy(); | ||
|
||
text.destroy(); | ||
text2.destroy(); | ||
|
||
expect(document.querySelector(query)).toBeFalsy(); | ||
}); | ||
}); |