Skip to content

Commit 67fc0e8

Browse files
committed
add Progress
1 parent 62a4c5d commit 67fc0e8

File tree

4 files changed

+34
-11
lines changed

4 files changed

+34
-11
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"sinon-chai": "^2.8.0",
8383
"through2": "^2.0.0",
8484
"watch": "^0.16.0",
85-
"webpack": "^1.12.2",
86-
"webpack-dev-server": "^1.12.0"
85+
"webpack": "1.12.1",
86+
"webpack-dev-server": "1.10.1"
8787
}
8888
}

src/modules/Progress/Progress.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import React, {Component, PropTypes} from 'react';
22
import classNames from 'classnames';
3+
import $ from 'jquery';
4+
import META from 'src/utils/Meta';
5+
36
export default class Progress extends Component {
47
static propTypes = {
58
autoSuccess: PropTypes.bool,
69
children: PropTypes.node,
710
className: PropTypes.string,
8-
color: PropTypes.string,
911
label: PropTypes.string,
1012
limitValues: PropTypes.bool,
1113
onActive: PropTypes.func,
@@ -29,22 +31,32 @@ export default class Progress extends Component {
2931
onError: this.props.onError,
3032
onSuccess: this.props.onSuccess,
3133
onWarning: this.props.onWarning,
34+
percent: this.props.percent,
3235
});
3336
}
3437

38+
static _meta = {
39+
library: META.library.stardust,
40+
name: 'Progress',
41+
type: META.type.module,
42+
};
43+
44+
plugin() {
45+
return this.element.progress(...arguments);
46+
}
47+
3548
render() {
36-
const color = this.props.percent < 100 ? this.props.color : 'success'
3749
const classes = classNames(
3850
'sd-progress',
3951
'ui',
52+
this.props.className,
4053
'progress',
41-
color,
42-
this.props.className
4354
);
55+
4456
return (
45-
<div className={classes} {...this.props}>
46-
<div className='bar' style={{width: `${this.props.percent.toString()}%`}}>
47-
<div className='progress' />
57+
<div {...this.props} className={classes}>
58+
<div className='bar'>
59+
<div className='progress'/>
4860
</div>
4961
{this.props.children}
5062
</div>

test/mocks/SemanticjQuery-mock.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const jQueryPlugins = {
2222
dropdown: sandbox.stub().returnsThis(),
2323
modal: sandbox.stub().returnsThis(),
2424
popup: sandbox.stub().returnsThis(),
25+
progress: sandbox.stub().returnsThis(),
2526
transition: sandbox.stub().returnsThis(),
2627
};
2728

test/specs/modules/Progress/Progress-test.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@ import React from 'react';
22
import {Progress} from 'stardust';
33

44
describe('Progress', () => {
5-
it('styles the bar\'s width after it\'s percent property', () => {
6-
render(<Progress />)
5+
it('should be able to receive children', () => {
6+
render(
7+
<Progress>
8+
<div className='new-child' />
9+
</Progress>
10+
).scryClass('new-child');
11+
});
12+
it('should create a div with the class of bar', () => {
13+
render(<Progress />).scryClass('bar');
14+
});
15+
it('should create a div with the class of progress', () => {
16+
render(<Progress />).scryClass('progress');
717
});
818
});

0 commit comments

Comments
 (0)