-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Alanna Scott
authored
Jul 15, 2016
1 parent
1fed498
commit 24e85f5
Showing
7 changed files
with
136 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"presets" : ["es2015", "react"] | ||
"presets" : ["airbnb", "es2015", "react"] | ||
} |
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 |
---|---|---|
|
@@ -4,4 +4,5 @@ cd "$(dirname "$0")" | |
npm --version | ||
npm install | ||
npm run lint | ||
npm run test | ||
npm run prod |
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 @@ | ||
/* eslint no-undef: 0, no-native-reassign: 0 */ | ||
|
||
require('babel-register')(); | ||
|
||
var jsdom = require('jsdom').jsdom; | ||
|
||
var exposedProperties = ['window', 'navigator', 'document']; | ||
|
||
global.document = jsdom(''); | ||
global.window = document.defaultView; | ||
Object.keys(document.defaultView).forEach((property) => { | ||
if (typeof global[property] === 'undefined') { | ||
exposedProperties.push(property); | ||
global[property] = document.defaultView[property]; | ||
} | ||
}); | ||
|
||
global.navigator = { | ||
userAgent: 'node.js' | ||
}; | ||
|
||
documentRef = document; |
35 changes: 35 additions & 0 deletions
35
caravel/assets/spec/javascripts/explore/components/QueryAndSaveBtns_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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import QueryAndSaveButtons from '../../../../javascripts/explore/components/QueryAndSaveBtns'; | ||
|
||
describe('QueryAndSaveButtons', () => { | ||
let defaultProps = { | ||
canAdd: 'True', | ||
onQuery: () => {} | ||
}; | ||
|
||
// It must render | ||
it('renders', () => { | ||
expect(React.isValidElement(<QueryAndSaveButtons {...defaultProps} />)).to.equal(true); | ||
}); | ||
|
||
// Test the output | ||
describe('output', () => { | ||
let wrapper; | ||
|
||
beforeEach(() => { | ||
wrapper = shallow(<QueryAndSaveButtons {...defaultProps} />); | ||
}); | ||
|
||
it('renders 2 buttons', () => { | ||
expect(wrapper.find('button')).to.have.lengthOf(2); | ||
}); | ||
|
||
it('renders buttons with correct text', () => { | ||
expect(wrapper.find('button').contains('Query')).to.eql(true); | ||
expect(wrapper.find('button').contains('Save as')).to.eql(true); | ||
}); | ||
}); | ||
}); |
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