Closed Bug 1199815 Opened 10 years ago Closed 10 years ago

Replace Error Summary at bottom of ui-showcase with React Component

Categories

(Hello (Loop) :: Client, defect, P2)

defect
Points:
1

Tracking

(firefox44 fixed)

RESOLVED FIXED
mozilla44
Iteration:
44.3 - Nov 2
Tracking Status
firefox44 --- fixed

People

(Reporter: dcritchley, Assigned: fcampo)

References

Details

(Whiteboard: [tech-debt][lang=js])

Attachments

(1 file, 2 obsolete files)

No description provided.
Points: --- → 1
Depends on: 1186362
Priority: -- → P2
Whiteboard: [tech-debt][lang=js]
Rank: 27
Assignee: nobody → fernando.campo
Comment on attachment 8677287 [details] [diff] [review] Replace Error Summary at bottom of ui-showcase with React Component also added missing <ul> tag
Attachment #8677287 - Flags: review?(standard8)
Comment on attachment 8677287 [details] [diff] [review] Replace Error Summary at bottom of ui-showcase with React Component Review of attachment 8677287 [details] [diff] [review]: ----------------------------------------------------------------- This is looking good. There's some eslint failures that need addressing - if you run eslint or use the run-all-loop-tests.sh, it should pick them up. You might also be able to add eslint into your editor as well. The rest of the comments are getting you closer to our normal styles, and a couple of bits of tidy up I think we could do whilst we're in the area. ::: browser/components/loop/ui/ui-showcase.jsx @@ +1312,5 @@ > + summary: React.PropTypes.string.isRequired, > + errorLine1: React.PropTypes.string.isRequired, > + errorLine2: React.PropTypes.string.isRequired > + }, > + render: function() { general nit: Please add a blank line in between object functions/properties. @@ +1314,5 @@ > + errorLine2: React.PropTypes.string.isRequired > + }, > + render: function() { > + return ( > + <li className = "test fail"> general nit: Generally in jsx code we do `className="test fail"`, i.e. no spaces either side of equals. @@ +1318,5 @@ > + <li className = "test fail"> > + <h2> > + {this.props.summary} > + </h2> > + <pre class="error"> This should be className. @@ +1335,5 @@ > + }, > + render: function() { > + var expectedWarnings = 0; > + var mismatch = this.props.warnings && > + this.props.warnings.length !== expectedWarnings; Not your fault, but now we're down at zero, I think we can simplify this to something like `!!this.props.warnings.length` @@ +1342,5 @@ > + var warningMsg = null; > + if (mismatch) { > + warningMsg = <Failure summary = 'Unexpected number of warnings detected in UI-Showcase' > + errorLine1 = {'Got: ' + this.props.warnings.length} > + errorLine2 = {'Expected: ' + expectedWarnings} /> Whilst you're here, could you change this to "Unexpected warnings detected rendering UI-Showcase", and then just print out the Got? @@ +1359,5 @@ > + <em>{totalFailures}</em> > + </div> > + <ul> > + {warningMsg} > + {errorMsg} It might be nicer to declare the <Failure .../> inline here, and pass in the `mismatch` or `this.props.error` as something like a `showErrors` property. The Failure class would then return null if showErrors is false. This would have the advantage of simplifying the readability, by not having to work through the various if statements.
Attachment #8677287 - Flags: review?(standard8) → review-
Attachment #8677287 - Attachment is obsolete: true
Attachment #8678798 - Flags: review?(standard8)
Comment on attachment 8678798 [details] [diff] [review] Replace Error Summary at bottom of ui-showcase with React Component Review of attachment 8678798 [details] [diff] [review]: ----------------------------------------------------------------- This is looking much better, but I now get: TypeError: this.props.error is undefined when I try and run it. ::: browser/components/loop/ui/ui-showcase.jsx @@ +1341,5 @@ > + }, > + > + render: function() { > + // if no errors, return blank > + return this.props.errorDetected ? ( I slightly prefer this format: if (!this.props.errorDetected) { return null; } ... As this reduces complexity with visually reading the code (you get the exception case out the way without having to find the other end at the end of the function).
Attachment #8678798 - Flags: review?(standard8)
all nits done, totally missed the console error the first time (tested only with existing error and warnings)
Attachment #8678798 - Attachment is obsolete: true
Attachment #8679513 - Flags: review?(standard8)
Comment on attachment 8679513 [details] [diff] [review] Replace Error Summary at bottom of ui-showcase with React Component Review of attachment 8679513 [details] [diff] [review]: ----------------------------------------------------------------- Looks good, r=Standard8
Attachment #8679513 - Flags: review?(standard8) → review+
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
Iteration: --- → 44.3 - Nov 2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: