-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly remove empty HTML tags when necessary.
- Loading branch information
1 parent
1877f27
commit 01b5bf6
Showing
6 changed files
with
129 additions
and
104 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
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 |
---|---|---|
@@ -1,53 +1,49 @@ | ||
import TypeIt from '../src/typeit'; | ||
import TypeIt from "../src/typeit"; | ||
|
||
test('Cursor should function by default.', () => { | ||
|
||
document.body.innerHTML = | ||
`<div>' | ||
test("Cursor should function by default.", () => { | ||
document.body.innerHTML = `<div>' | ||
<span id="element"></span> | ||
</div>`; | ||
|
||
const instance = new TypeIt('#element', { | ||
const instance = new TypeIt("#element", { | ||
strings: ["This should have a default cursor."] | ||
}); | ||
|
||
let cursorCharacter = document.getElementById('element').querySelector('.ti-cursor').innerHTML; | ||
let cursorCharacter = document | ||
.getElementById("element") | ||
.querySelector(".ti-cursor").innerHTML; | ||
|
||
expect(cursorCharacter).toBe('|'); | ||
expect(cursorCharacter).toBe("|"); | ||
}); | ||
|
||
test('Changes cursor character correctly.', () => { | ||
|
||
document.body.innerHTML = | ||
`<div>' | ||
test("Changes cursor character correctly.", () => { | ||
document.body.innerHTML = `<div>' | ||
<span id="element"></span> | ||
</div>`; | ||
|
||
const instance = new TypeIt('#element', { | ||
const instance = new TypeIt("#element", { | ||
strings: ["This should have a custom cursor."], | ||
cursorChar: '$' | ||
cursorChar: "$" | ||
}); | ||
|
||
let cursorCharacter = document.getElementById('element').querySelector('.ti-cursor').innerHTML; | ||
let cursorCharacter = document | ||
.getElementById("element") | ||
.querySelector(".ti-cursor").innerHTML; | ||
|
||
expect(cursorCharacter).toBe('$'); | ||
expect(cursorCharacter).toBe("$"); | ||
}); | ||
|
||
test('Turning off cursor should work.', () => { | ||
|
||
document.body.innerHTML = | ||
`<div>' | ||
test("Turning off cursor should work.", () => { | ||
document.body.innerHTML = `<div>' | ||
<span id="element"></span> | ||
</div>`; | ||
|
||
const instance = new TypeIt('#element', { | ||
const instance = new TypeIt("#element", { | ||
strings: ["This should have no cursor."], | ||
cursor: false | ||
}); | ||
|
||
let visibilityStyle = document.getElementById('element').style.visibility; | ||
let visibilityStyle = document.getElementById("element").style.visibility; | ||
|
||
expect(visibilityStyle).toBe(''); | ||
expect(visibilityStyle).toBe(""); | ||
}); | ||
|
||
|
Oops, something went wrong.