forked from preactjs/preact-render-to-string
-
Notifications
You must be signed in to change notification settings - Fork 3
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 #1 from MicheleBertoli/className-to-class
Render class instead of className
- Loading branch information
Showing
2 changed files
with
27 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
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,22 @@ | ||
import { render } from '../src'; | ||
import { h } from 'preact'; | ||
import { expect } from 'chai'; | ||
|
||
describe('className / class massaging', () => { | ||
it('should render class using className', () => { | ||
let rendered = render(<div className="foo bar" />); | ||
expect(rendered.props).to.have.property('class', 'foo bar'); | ||
expect(rendered.props).to.not.have.property('className'); | ||
}); | ||
|
||
it('should render class using class', () => { | ||
let rendered = render(<div class="foo bar" />); | ||
expect(rendered.props).to.have.property('class', 'foo bar'); | ||
}); | ||
|
||
it('should prefer class over className', () => { | ||
let rendered = render(<div class="foo" className="foo bar" />); | ||
expect(rendered.props).to.have.property('class', 'foo'); | ||
expect(rendered.props).to.not.have.property('className'); | ||
}); | ||
}); |