Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit bab00bd

Browse files
authored
Merge pull request #55 from makotot/export
export as default
2 parents 1643c50 + 25351cb commit bab00bd

File tree

7 files changed

+16
-92
lines changed

7 files changed

+16
-92
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ $ npm i react-scrollspy
2020
## Usage
2121

2222
```js
23-
var Scrollspy = require('react-scrollspy').Scrollspy;
23+
import Scrollspy from 'react-scrollspy'
2424

2525
...
2626

__test__/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import test from 'ava'
22
import React from 'react'
33
import { shallow, mount, render } from 'enzyme'
4-
import { Scrollspy } from '../src/js/lib/Scrollspy'
4+
import Scrollspy from '../src/js/lib/Scrollspy'
55

66
test('renders correct children length', (t) => {
77
const wrapper = shallow(
@@ -22,3 +22,12 @@ test('renders children with correct props', (t) => {
2222
)
2323
t.is(wrapper.find('li').prop('randomProp'), 'someText')
2424
})
25+
26+
test('renders expected html tag', (t) => {
27+
const defaultTag = shallow(<Scrollspy></Scrollspy>)
28+
const customTag = shallow(<Scrollspy componentTag={ 'div' }></Scrollspy>)
29+
30+
t.is(defaultTag.type(), 'ul')
31+
t.is(customTag.type(), 'div')
32+
})
33+

docs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mkdir gh_pages
55
ls -la
66
cd gh_pages
77

8-
cp -r ../build/* .
8+
cp -r ../dist/* .
99

1010
git init
1111
git config user.name "${GIT_COMITTER_NAME}"

gulpfile.js

Lines changed: 0 additions & 85 deletions
This file was deleted.

src/js/app.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
22
import ReactDOM from 'react-dom'
3-
import { Scrollspy } from './lib/Scrollspy.jsx'
3+
import Scrollspy from './lib/Scrollspy.jsx'
44
import Highlight from 'react-highlight'
55

66
import 'style-loader!css-loader!postcss-loader!sass-loader!../scss/app.scss'
@@ -64,7 +64,7 @@ const App = React.createClass({
6464
</pre>
6565
<p className="c-paragraph">Then, import this library in your JS.</p>
6666
<pre className="c-code">
67-
<Highlight className="c-code__inner">{'import { Scrollspy } from \'react-scrollspy\''}</Highlight>
67+
<Highlight className="c-code__inner">{'import Scrollspy from \'react-scrollspy\''}</Highlight>
6868
</pre>
6969
</div>
7070
</div>

src/js/lib/Scrollspy.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react'
33
import classNames from 'classnames'
44
import throttle from './throttle'
55

6-
export class Scrollspy extends React.Component {
6+
export default class Scrollspy extends React.Component {
77

88
static get PropTypes () {
99
return {

webpack.config.babel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default {
6262
plugins: [
6363
new HtmlWebpackPlguin({
6464
filename: 'index.html',
65-
inject: true,
65+
inject: false,
6666
template: './src/templates/index.ejs',
6767
}),
6868
new webpack.LoaderOptionsPlugin({

0 commit comments

Comments
 (0)