Skip to content

Commit

Permalink
fix: #26 mocha test error
Browse files Browse the repository at this point in the history
  • Loading branch information
fireyy committed Jun 20, 2017
1 parent 14a5cb0 commit 498654b
Show file tree
Hide file tree
Showing 5 changed files with 661 additions and 317 deletions.
1 change: 1 addition & 0 deletions mocha-compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ function noop() {
return null;
}

require.extensions['.css'] = noop;
require.extensions['.less'] = noop;
require.extensions['.png'] = noop;
// ..etc
4 changes: 2 additions & 2 deletions src/components/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import './index.less'
import { Link } from 'react-router'

const contextTypes = {
router: PropTypes.object.isRequired
router: PropTypes.object
};

const { Header } = Layout;
Expand Down Expand Up @@ -56,7 +56,7 @@ export default class commonHeader extends React.Component {
<Col span={3}>
<Dropdown overlay={menu}>
<a className="ant-dropdown-link" href="#">
<Icon type="user" /> {username} <Icon type="down" />
<Icon type="user" /> <span>{username}</span> <Icon type="down" />
</a>
</Dropdown>
</Col>
Expand Down
5 changes: 5 additions & 0 deletions src/views/Login/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@
width: 100%;
}
}
.ant-input-affix-wrapper {
.ant-input {
min-height: auto;
}
}
}
17 changes: 12 additions & 5 deletions tests/Header-test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import React from 'react';
import { expect } from 'chai';
import { shallow, mount, render } from 'enzyme';
import Header from '../src/components/Header/Header';
import Header from '../src/components/Header/index.jsx';

let auth = {
user: {
name: "fireyy"
}
};
let logout = () => {};

describe("<Header />", function() {
it("shallow", function() {
expect(shallow(<Header />).is('.ant-layout-header')).to.equal(true);
it("mount", function() {
expect(mount(<Header profile={auth} logout={logout} />).find('.ant-layout-header').length).to.equal(1);
});

it("mount", function() {
expect(mount(<Header />).find('.ant-layout-header').length).to.equal(1);
it("pass user profile", function() {
expect(mount(<Header profile={auth} logout={logout} />).find('.ant-dropdown-link span').html()).to.contain('fireyy');
});
});
Loading

0 comments on commit 498654b

Please sign in to comment.