-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
86a377d
commit 71a5c42
Showing
9 changed files
with
80 additions
and
63 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
23 changes: 15 additions & 8 deletions
23
caravel/assets/spec/javascripts/sqllab/HighlightedSql_spec.jsx
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,26 +1,33 @@ | ||
import React from 'react'; | ||
import HighlightedSql from '../../../javascripts/SqlLab/components/HighlightedSql'; | ||
import ModalTrigger from '../../../javascripts/components/ModalTrigger'; | ||
import SyntaxHighlighter from 'react-syntax-highlighter'; | ||
import { shallow } from 'enzyme'; | ||
import { mount, shallow } from 'enzyme'; | ||
import { describe, it } from 'mocha'; | ||
import { expect } from 'chai'; | ||
|
||
|
||
describe('HighlightedSql', () => { | ||
const sql = "SELECT * FROM test WHERE something='fkldasjfklajdslfkjadlskfjkldasjfkladsjfkdjsa'"; | ||
it('renders', () => { | ||
expect(React.isValidElement(<HighlightedSql />)).to.equal(true); | ||
}); | ||
it('renders with props', () => { | ||
expect(React.isValidElement(<HighlightedSql sql={sql} />)) | ||
.to.equal(true); | ||
}); | ||
it('renders a SyntaxHighlighter', () => { | ||
it('renders a ModalTrigger', () => { | ||
const wrapper = shallow(<HighlightedSql sql={sql} />); | ||
expect(wrapper.find(SyntaxHighlighter)).to.have.length(1); | ||
expect(wrapper.find(ModalTrigger)).to.have.length(1); | ||
}); | ||
it('renders a SyntaxHighlighter while using shrink', () => { | ||
it('renders a ModalTrigger while using shrink', () => { | ||
const wrapper = shallow(<HighlightedSql sql={sql} shrink maxWidth={20} />); | ||
expect(wrapper.find(SyntaxHighlighter)).to.have.length(1); | ||
expect(wrapper.find(ModalTrigger)).to.have.length(1); | ||
}); | ||
it('renders two SyntaxHighlighter in modal', () => { | ||
const wrapper = mount( | ||
<HighlightedSql sql={sql} rawSql="SELECT * FORM foo" shrink maxWidth={5} />); | ||
const well = wrapper.find('.well'); | ||
expect(well).to.have.length(1); | ||
well.simulate('click'); | ||
const modalBody = mount(wrapper.state().modalBody); | ||
expect(modalBody.find(SyntaxHighlighter)).to.have.length(2); | ||
}); | ||
}); |
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