From cfb372aebfc327d22ec6c90b2f4b9923f312895d Mon Sep 17 00:00:00 2001 From: eanplatter Date: Tue, 24 Nov 2015 18:34:07 -0600 Subject: [PATCH 01/11] add progress --- .DS_Store | Bin 0 -> 6148 bytes .idea/.name | 1 + .idea/encodings.xml | 6 + .idea/jsLibraryMappings.xml | 7 + .idea/libraries/stardust_node_modules.xml | 14 ++ .idea/misc.xml | 16 ++ .idea/modules.xml | 8 + .idea/stardust.iml | 9 + .idea/vcs.xml | 6 + .idea/workspace.xml | 235 +++++++++++++++++++ src/.DS_Store | Bin 0 -> 6148 bytes src/index.js | 4 +- src/modules/Progress/Progress.js | 53 +++++ test/specs/modules/Progress/Progress-test.js | 8 + 14 files changed, 366 insertions(+), 1 deletion(-) create mode 100644 .DS_Store create mode 100644 .idea/.name create mode 100644 .idea/encodings.xml create mode 100644 .idea/jsLibraryMappings.xml create mode 100644 .idea/libraries/stardust_node_modules.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/stardust.iml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 src/.DS_Store create mode 100644 src/modules/Progress/Progress.js create mode 100644 test/specs/modules/Progress/Progress-test.js diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1cdc4c0e16e987e0e9be9fcee32021d7e310cf52 GIT binary patch literal 6148 zcmeHK%}T>S5Z-O8ruGt1LGhBSpwObFc#E|jg+ir8RBB=ZT_{OuQj3&A&OV0!kKsY| z8GIE_&g`zGQoVQ(DKlaAo1L9Wm~UY>!x-b`o>ySZWQ-Z0h^Z_L-w3XwPDo07I3TFW zqK?}RU6{SQor!32{6_|G@6s${U3TvF$M>%-qBx&_a7$=F(mm#EuC3?pW$cLj+#fFNeLri%x3l zeGTEot){tL?fMsxT6F@yE+XNIwumo{EIv(hbuif6DQ<6A+lAtA!y1%Id9b%i!=d?P z7;Edr-Gigf@ap>J_U``S@%cq<0>`>h78Q)f*O5gAF+dCu1JlcZJ_C*1^p;4K5d*}) zFB!n|!2(6JH6{w>(E)>O0RS`LmI5~R5}0FYv^6FQVFiS%R6v!=b&J7OI`}OeXKPFp zs&vM6^TG9(x$aQ7{5rhflHrWo3TY$;h=H#Rq}9~K`+xuE{{L$d&4>YFV5%74nM$ov zhLZH%I#C?nwHD|ZC&YX4M1CCq7XbF^dlf?pn(|pQwBZ& DZcJX? literal 0 HcmV?d00001 diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000000..39df5930fa --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +stardust \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000000..97626ba454 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 0000000000..5ecfd4e5e8 --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/stardust_node_modules.xml b/.idea/libraries/stardust_node_modules.xml new file mode 100644 index 0000000000..47e2f1cc0b --- /dev/null +++ b/.idea/libraries/stardust_node_modules.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000..e503d882ca --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000..6fe2354c5a --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/stardust.iml b/.idea/stardust.iml new file mode 100644 index 0000000000..d48328d247 --- /dev/null +++ b/.idea/stardust.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000..94a25f7f4c --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000000..6c069425c7 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,235 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $PROJECT_DIR$ + true + + bdd + + DIRECTORY + + false + + + + + + + + 1448404314641 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..4e8a4e46529790c989ca73aaef3377b65482fb0d GIT binary patch literal 6148 zcmeHK%}T>S5ZC=C>Ys}yD$8H%beee!o(4w-~AMNd>}$E>er)Q z=*7oPwcmm8l6K2nXmtH^2yHl_zb|6pia;b6Mjl(sTpA44Hma3Xt5U8GSFJ&G`(S}0+8R@Z^67w1mH>cRa7zIjYYB|8G};K?b@9RVm$|M`xcoZoZ^`A1+X|^C28e;L3{0t^iTQu$=lcI^5RHfdVql^e z;Mwiwb{&qSbL-gQFxOh3r=TdfE>$=R0Yj!@Sc|E65mXBJEi?dajj2NLfY6VCq=7nO I;7=KN2Z*;|5&!@I literal 0 HcmV?d00001 diff --git a/src/index.js b/src/index.js index 5e9e53d0c0..d6669172d8 100644 --- a/src/index.js +++ b/src/index.js @@ -29,6 +29,7 @@ import Segment from 'src/elements/Segment/Segment'; // Modules import Checkbox from 'src/modules/Checkbox/Checkbox'; +import Progress from 'src/modules/Progress/Progress'; import Modal from 'src/modules/Modal/Modal'; import ModalContent from 'src/modules/Modal/ModalContent'; import ModalFooter from 'src/modules/Modal/ModalFooter'; @@ -72,11 +73,12 @@ export default { // Modules Checkbox, + Dropdown, Modal, ModalContent, ModalFooter, ModalHeader, - Dropdown, + Progress, // Views Item, diff --git a/src/modules/Progress/Progress.js b/src/modules/Progress/Progress.js new file mode 100644 index 0000000000..dc2ef8e9bc --- /dev/null +++ b/src/modules/Progress/Progress.js @@ -0,0 +1,53 @@ +import React, {Component, PropTypes} from 'react'; +import classNames from 'classnames'; +export default class Progress extends Component { + static propTypes = { + autoSuccess: PropTypes.bool, + children: PropTypes.node, + className: PropTypes.string, + color: PropTypes.string, + label: PropTypes.string, + limitValues: PropTypes.bool, + onActive: PropTypes.func, + onChange: PropTypes.func, + onError: PropTypes.func, + onSuccess: PropTypes.func, + onWarning: PropTypes.func, + percent: PropTypes.number, + precision: PropTypes.number, + random: PropTypes.bool, + showActivity: PropTypes.bool, + total: PropTypes.bool, + value: PropTypes.bool, + }; + + componentDidMount() { + this.element = $(this.refs.element); + this.element.progress({ + onActive: this.props.onActive, + onChange: this.props.onChange, + onError: this.props.onError, + onSuccess: this.props.onSuccess, + onWarning: this.props.onWarning, + }); + } + + render() { + const color = this.props.percent < 100 ? this.props.color : 'success' + const classes = classNames( + 'sd-progress', + 'ui', + 'progress', + color, + this.props.className + ); + return ( +
+
+
+
+ {this.props.children} +
+ ); + } +} diff --git a/test/specs/modules/Progress/Progress-test.js b/test/specs/modules/Progress/Progress-test.js new file mode 100644 index 0000000000..44286f8b4e --- /dev/null +++ b/test/specs/modules/Progress/Progress-test.js @@ -0,0 +1,8 @@ +import React from 'react'; +import {Progress} from 'stardust'; + +describe('Progress', () => { + it('styles the bar\'s width after it\'s percent property', () => { + render() + }); +}); From f09f57b16c32f02e4c31e7b43b6d58a45d650031 Mon Sep 17 00:00:00 2001 From: eanplatter Date: Tue, 24 Nov 2015 18:46:53 -0600 Subject: [PATCH 02/11] add idea to git ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9b2acd0789..032bc9cb47 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ bower_components/ testBundle.js docs/build docgenInfo.json +.idea From 62a4c5d7aca0b915c2fd94bdeba5dcf44358ac6b Mon Sep 17 00:00:00 2001 From: eanplatter Date: Tue, 24 Nov 2015 18:59:04 -0600 Subject: [PATCH 03/11] merge in changes --- .gitignore | 2 +- .idea/.name | 1 - .idea/encodings.xml | 6 - .idea/jsLibraryMappings.xml | 7 - .idea/libraries/stardust_node_modules.xml | 14 -- .idea/misc.xml | 16 -- .idea/modules.xml | 8 - .idea/stardust.iml | 9 - .idea/vcs.xml | 6 - .idea/workspace.xml | 235 ---------------------- 10 files changed, 1 insertion(+), 303 deletions(-) delete mode 100644 .idea/.name delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/jsLibraryMappings.xml delete mode 100644 .idea/libraries/stardust_node_modules.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/stardust.iml delete mode 100644 .idea/vcs.xml delete mode 100644 .idea/workspace.xml diff --git a/.gitignore b/.gitignore index 032bc9cb47..6cdc9d8c1d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,4 @@ bower_components/ testBundle.js docs/build docgenInfo.json -.idea +.idea/ diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 39df5930fa..0000000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -stardust \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 97626ba454..0000000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml deleted file mode 100644 index 5ecfd4e5e8..0000000000 --- a/.idea/jsLibraryMappings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/stardust_node_modules.xml b/.idea/libraries/stardust_node_modules.xml deleted file mode 100644 index 47e2f1cc0b..0000000000 --- a/.idea/libraries/stardust_node_modules.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index e503d882ca..0000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 6fe2354c5a..0000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/stardust.iml b/.idea/stardust.iml deleted file mode 100644 index d48328d247..0000000000 --- a/.idea/stardust.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f4c..0000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 6c069425c7..0000000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $PROJECT_DIR$ - true - - bdd - - DIRECTORY - - false - - - - - - - - 1448404314641 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 67fc0e81b1d603b154f720ea9bbf4cb48d736dd8 Mon Sep 17 00:00:00 2001 From: eanplatter Date: Wed, 2 Dec 2015 14:11:24 -0600 Subject: [PATCH 04/11] add Progress --- package.json | 4 +-- src/modules/Progress/Progress.js | 26 ++++++++++++++------ test/mocks/SemanticjQuery-mock.js | 1 + test/specs/modules/Progress/Progress-test.js | 14 +++++++++-- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 3322ac0644..ca1d8f0ca9 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "sinon-chai": "^2.8.0", "through2": "^2.0.0", "watch": "^0.16.0", - "webpack": "^1.12.2", - "webpack-dev-server": "^1.12.0" + "webpack": "1.12.1", + "webpack-dev-server": "1.10.1" } } diff --git a/src/modules/Progress/Progress.js b/src/modules/Progress/Progress.js index dc2ef8e9bc..4bdcca2937 100644 --- a/src/modules/Progress/Progress.js +++ b/src/modules/Progress/Progress.js @@ -1,11 +1,13 @@ import React, {Component, PropTypes} from 'react'; import classNames from 'classnames'; +import $ from 'jquery'; +import META from 'src/utils/Meta'; + export default class Progress extends Component { static propTypes = { autoSuccess: PropTypes.bool, children: PropTypes.node, className: PropTypes.string, - color: PropTypes.string, label: PropTypes.string, limitValues: PropTypes.bool, onActive: PropTypes.func, @@ -29,22 +31,32 @@ export default class Progress extends Component { onError: this.props.onError, onSuccess: this.props.onSuccess, onWarning: this.props.onWarning, + percent: this.props.percent, }); } + static _meta = { + library: META.library.stardust, + name: 'Progress', + type: META.type.module, + }; + + plugin() { + return this.element.progress(...arguments); + } + render() { - const color = this.props.percent < 100 ? this.props.color : 'success' const classes = classNames( 'sd-progress', 'ui', + this.props.className, 'progress', - color, - this.props.className ); + return ( -
-
-
+
+
+
{this.props.children}
diff --git a/test/mocks/SemanticjQuery-mock.js b/test/mocks/SemanticjQuery-mock.js index 65bde39ea5..3c5693ff14 100644 --- a/test/mocks/SemanticjQuery-mock.js +++ b/test/mocks/SemanticjQuery-mock.js @@ -22,6 +22,7 @@ const jQueryPlugins = { dropdown: sandbox.stub().returnsThis(), modal: sandbox.stub().returnsThis(), popup: sandbox.stub().returnsThis(), + progress: sandbox.stub().returnsThis(), transition: sandbox.stub().returnsThis(), }; diff --git a/test/specs/modules/Progress/Progress-test.js b/test/specs/modules/Progress/Progress-test.js index 44286f8b4e..b0f98d4294 100644 --- a/test/specs/modules/Progress/Progress-test.js +++ b/test/specs/modules/Progress/Progress-test.js @@ -2,7 +2,17 @@ import React from 'react'; import {Progress} from 'stardust'; describe('Progress', () => { - it('styles the bar\'s width after it\'s percent property', () => { - render() + it('should be able to receive children', () => { + render( + +
+ + ).scryClass('new-child'); + }); + it('should create a div with the class of bar', () => { + render().scryClass('bar'); + }); + it('should create a div with the class of progress', () => { + render().scryClass('progress'); }); }); From b0d551207bb0851dc5ed59654bc9cabb9108ebc9 Mon Sep 17 00:00:00 2001 From: eanplatter Date: Thu, 3 Dec 2015 20:32:02 -0600 Subject: [PATCH 05/11] remove someone's DS_Store --- src/.DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/.DS_Store diff --git a/src/.DS_Store b/src/.DS_Store deleted file mode 100644 index 4e8a4e46529790c989ca73aaef3377b65482fb0d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5ZC=C>Ys}yD$8H%beee!o(4w-~AMNd>}$E>er)Q z=*7oPwcmm8l6K2nXmtH^2yHl_zb|6pia;b6Mjl(sTpA44Hma3Xt5U8GSFJ&G`(S}0+8R@Z^67w1mH>cRa7zIjYYB|8G};K?b@9RVm$|M`xcoZoZ^`A1+X|^C28e;L3{0t^iTQu$=lcI^5RHfdVql^e z;Mwiwb{&qSbL-gQFxOh3r=TdfE>$=R0Yj!@Sc|E65mXBJEi?dajj2NLfY6VCq=7nO I;7=KN2Z*;|5&!@I From 46463e0d2ef2f75983743a36a59a3f1bd98cd796 Mon Sep 17 00:00:00 2001 From: eanplatter Date: Fri, 4 Dec 2015 11:00:39 -0600 Subject: [PATCH 06/11] remove idea from gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6cdc9d8c1d..9b2acd0789 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,3 @@ bower_components/ testBundle.js docs/build docgenInfo.json -.idea/ From d799baa96668aace5125430d548020db479cc8a4 Mon Sep 17 00:00:00 2001 From: eanplatter Date: Sun, 6 Dec 2015 23:18:29 -0600 Subject: [PATCH 07/11] update progress module --- src/modules/Progress/Progress.js | 40 ++++++++++++++++++-- test/specs/modules/Progress/Progress-test.js | 17 ++++++--- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/src/modules/Progress/Progress.js b/src/modules/Progress/Progress.js index 4bdcca2937..de546efe67 100644 --- a/src/modules/Progress/Progress.js +++ b/src/modules/Progress/Progress.js @@ -26,12 +26,22 @@ export default class Progress extends Component { componentDidMount() { this.element = $(this.refs.element); this.element.progress({ + autoSuccess: this.props.autoSuccess, + children: this.props.children, + className: this.props.className, + label: this.props.label, + limitValues: this.props.limitValues, onActive: this.props.onActive, onChange: this.props.onChange, onError: this.props.onError, onSuccess: this.props.onSuccess, onWarning: this.props.onWarning, percent: this.props.percent, + precision: this.props.precision, + random: this.props.random, + showActivity: this.props.showActivity, + total: this.props.total, + value: this.props.value, }); } @@ -45,6 +55,25 @@ export default class Progress extends Component { return this.element.progress(...arguments); } + renderAttachedBar() { + return ( +
+ ); + } + + renderStandardBar() { + return ( +
+
+
+
+
+ {this.props.children} +
+
+ ); + } + render() { const classes = classNames( 'sd-progress', @@ -53,12 +82,15 @@ export default class Progress extends Component { 'progress', ); + let content = ::this.renderStandardBar(); + + if (this.props.className && this.props.className.indexOf('attached') !== -1) { + content = ::this.renderAttachedBar(); + } + return (
-
-
-
- {this.props.children} + {content}
); } diff --git a/test/specs/modules/Progress/Progress-test.js b/test/specs/modules/Progress/Progress-test.js index b0f98d4294..67130f0523 100644 --- a/test/specs/modules/Progress/Progress-test.js +++ b/test/specs/modules/Progress/Progress-test.js @@ -5,14 +5,19 @@ describe('Progress', () => { it('should be able to receive children', () => { render( -
+ Child - ).scryClass('new-child'); + ).assertText('Child'); }); + it('should create a div with the class of bar', () => { - render().scryClass('bar'); - }); - it('should create a div with the class of progress', () => { - render().scryClass('progress'); + render().findClass('bar'); }); + + // it('should create a div with the class of progress', () => { + // const bugger = render(); + // console.log(bugger); + // debugger; + // render().scryClass('progress'); + // }); }); From 429f726c16a9dbc9f8615919bbbf42fd248d30b2 Mon Sep 17 00:00:00 2001 From: ean Date: Sun, 6 Dec 2015 23:19:42 -0600 Subject: [PATCH 08/11] Update Progress-test.js --- test/specs/modules/Progress/Progress-test.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/specs/modules/Progress/Progress-test.js b/test/specs/modules/Progress/Progress-test.js index 67130f0523..d22d0d9255 100644 --- a/test/specs/modules/Progress/Progress-test.js +++ b/test/specs/modules/Progress/Progress-test.js @@ -15,9 +15,6 @@ describe('Progress', () => { }); // it('should create a div with the class of progress', () => { - // const bugger = render(); - // console.log(bugger); - // debugger; - // render().scryClass('progress'); + // render().firstClass('progress'); // }); }); From fdd2d4890c2b9e0759e293476028d3860143f24a Mon Sep 17 00:00:00 2001 From: eanplatter Date: Mon, 7 Dec 2015 13:11:12 -0600 Subject: [PATCH 09/11] update per review --- src/modules/Progress/Progress.js | 33 ++++++++++---------- test/specs/modules/Progress/Progress-test.js | 19 ++++++----- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/modules/Progress/Progress.js b/src/modules/Progress/Progress.js index de546efe67..26c4f4561e 100644 --- a/src/modules/Progress/Progress.js +++ b/src/modules/Progress/Progress.js @@ -2,13 +2,14 @@ import React, {Component, PropTypes} from 'react'; import classNames from 'classnames'; import $ from 'jquery'; import META from 'src/utils/Meta'; +import _ from 'lodash'; export default class Progress extends Component { static propTypes = { autoSuccess: PropTypes.bool, children: PropTypes.node, className: PropTypes.string, - label: PropTypes.string, + label: PropTypes.oneOf(['ratio', 'percent']), limitValues: PropTypes.bool, onActive: PropTypes.func, onChange: PropTypes.func, @@ -27,8 +28,6 @@ export default class Progress extends Component { this.element = $(this.refs.element); this.element.progress({ autoSuccess: this.props.autoSuccess, - children: this.props.children, - className: this.props.className, label: this.props.label, limitValues: this.props.limitValues, onActive: this.props.onActive, @@ -55,24 +54,28 @@ export default class Progress extends Component { return this.element.progress(...arguments); } - renderAttachedBar() { + renderAttachedBar = () => { return (
); - } + }; + + renderStandardBar = () => { + const label = ( +
+ {this.props.children} +
+ ); - renderStandardBar() { return (
-
- {this.props.children} -
+ {this.props.children && label}
); - } + }; render() { const classes = classNames( @@ -82,15 +85,11 @@ export default class Progress extends Component { 'progress', ); - let content = ::this.renderStandardBar(); - - if (this.props.className && this.props.className.indexOf('attached') !== -1) { - content = ::this.renderAttachedBar(); - } - + const isAttached = _.contains(this.props.className, 'attached'); + console.log(isAttached, classes); return (
- {content} + {isAttached ? this.renderAttachedBar() : this.renderStandardBar()}
); } diff --git a/test/specs/modules/Progress/Progress-test.js b/test/specs/modules/Progress/Progress-test.js index 67130f0523..986dad0143 100644 --- a/test/specs/modules/Progress/Progress-test.js +++ b/test/specs/modules/Progress/Progress-test.js @@ -1,7 +1,7 @@ import React from 'react'; import {Progress} from 'stardust'; -describe('Progress', () => { +describe.only('Progress', () => { it('should be able to receive children', () => { render( @@ -14,10 +14,15 @@ describe('Progress', () => { render().findClass('bar'); }); - // it('should create a div with the class of progress', () => { - // const bugger = render(); - // console.log(bugger); - // debugger; - // render().scryClass('progress'); - // }); + it('should create two progress divs if un-attached', () => { + render() + .scryClass('progress') + .should.have.a.lengthOf(2); + }); + + it('should not create extra progress div if attached', () => { + render() + .scryClass('progress') + .should.have.a.lengthOf(1); + }); }); From c8194035576bcbd31f611e76da1fc54210c85a51 Mon Sep 17 00:00:00 2001 From: ean Date: Mon, 7 Dec 2015 13:35:34 -0600 Subject: [PATCH 10/11] Delete .DS_Store --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 1cdc4c0e16e987e0e9be9fcee32021d7e310cf52..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5Z-O8ruGt1LGhBSpwObFc#E|jg+ir8RBB=ZT_{OuQj3&A&OV0!kKsY| z8GIE_&g`zGQoVQ(DKlaAo1L9Wm~UY>!x-b`o>ySZWQ-Z0h^Z_L-w3XwPDo07I3TFW zqK?}RU6{SQor!32{6_|G@6s${U3TvF$M>%-qBx&_a7$=F(mm#EuC3?pW$cLj+#fFNeLri%x3l zeGTEot){tL?fMsxT6F@yE+XNIwumo{EIv(hbuif6DQ<6A+lAtA!y1%Id9b%i!=d?P z7;Edr-Gigf@ap>J_U``S@%cq<0>`>h78Q)f*O5gAF+dCu1JlcZJ_C*1^p;4K5d*}) zFB!n|!2(6JH6{w>(E)>O0RS`LmI5~R5}0FYv^6FQVFiS%R6v!=b&J7OI`}OeXKPFp zs&vM6^TG9(x$aQ7{5rhflHrWo3TY$;h=H#Rq}9~K`+xuE{{L$d&4>YFV5%74nM$ov zhLZH%I#C?nwHD|ZC&YX4M1CCq7XbF^dlf?pn(|pQwBZ& DZcJX? From 0fdcf8ed36308b23656e1815f81293272d0e0429 Mon Sep 17 00:00:00 2001 From: ean Date: Mon, 7 Dec 2015 13:48:27 -0600 Subject: [PATCH 11/11] Update Progress.js --- src/modules/Progress/Progress.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/modules/Progress/Progress.js b/src/modules/Progress/Progress.js index 26c4f4561e..1c77311321 100644 --- a/src/modules/Progress/Progress.js +++ b/src/modules/Progress/Progress.js @@ -86,7 +86,6 @@ export default class Progress extends Component { ); const isAttached = _.contains(this.props.className, 'attached'); - console.log(isAttached, classes); return (
{isAttached ? this.renderAttachedBar() : this.renderStandardBar()}