-
Notifications
You must be signed in to change notification settings - Fork 7
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 #38 from NickStefan/fullDOM
Allow rendering into the document.body
- Loading branch information
Showing
5 changed files
with
37 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import Find from './middleware/find' | ||
import SetState from './middleware/setState' | ||
import Simulate from './middleware/simulate' | ||
import Clean from './middleware/clean' | ||
|
||
export default { | ||
Find, | ||
SetState, | ||
Simulate | ||
Simulate, | ||
Clean | ||
} |
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,7 @@ | ||
export default function Clean(){ | ||
this.instance = null | ||
this.elements = null | ||
if (global.window){ | ||
global.window.document.body.innerHTML = '' | ||
} | ||
} |
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,18 @@ | ||
import Test from '../src/legit-tests' | ||
import { expect } from 'chai' | ||
|
||
describe('Render into document.body', () => { | ||
|
||
it('should render and clean up component', () => { | ||
Test(<section />, {fullDOM: true}) | ||
.test(function() { | ||
expect(global.window.document.querySelector('section')) | ||
.to.not.equal(null) | ||
}) | ||
.clean() | ||
|
||
// clean should clean up the document.body | ||
expect(global.window.document.body.innerHTML).to.equal('') | ||
}) | ||
|
||
}) |