Closed Bug 1332085 Opened 8 years ago Closed 8 years ago

Add Color Name field to Color Widget

Categories

(DevTools :: Inspector: Rules, defect, P3)

defect

Tracking

(firefox55 fixed)

RESOLVED FIXED
Firefox 55
Tracking Status
firefox55 --- fixed

People

(Reporter: gl, Assigned: sroddick)

References

(Blocks 1 open bug, )

Details

Attachments

(2 files, 4 obsolete files)

Add the Named Color component to the Color Widget. This bug is reserved for UCOSP students.
Assignee: nobody → sheldon.roddick
Status: NEW → ASSIGNED
Attached patch Bug1332085.patch v1 (obsolete) — Splinter Review
Attachment #8828993 - Flags: review?(gl)
Comment on attachment 8828993 [details] [diff] [review] Bug1332085.patch v1 Review of attachment 8828993 [details] [diff] [review]: ----------------------------------------------------------------- ::: devtools/client/locales/en-US/colorwidget.properties @@ +2,5 @@ > +# License, v. 2.0. If a copy of the MPL was not distributed with this > +# file, You can obtain one at http://mozilla.org/MPL/2.0/. > + > +# LOCALIZATION NOTE These strings are used in the CSS Color Editor Widget > +# which can be found in a tooltip that appears in the Rule View when clicking s/Rule/Rules @@ +3,5 @@ > +# file, You can obtain one at http://mozilla.org/MPL/2.0/. > + > +# LOCALIZATION NOTE These strings are used in the CSS Color Editor Widget > +# which can be found in a tooltip that appears in the Rule View when clicking > +# on a color swatch displayed next to CSS declarations like 'color: #FFF' Add a period to the end of the sentence. @@ +6,5 @@ > +# which can be found in a tooltip that appears in the Rule View when clicking > +# on a color swatch displayed next to CSS declarations like 'color: #FFF' > + > +# LOCALIZATION NOTE (colorNameLabel): > +# This string is displayed to indicate the field in which the currently I think we should move the string so it starts right after the ":", and I think we can simplify the string to read: The label for the current color widget's color name field. ::: devtools/client/shared/test/browser_color-widget-01.js @@ +117,5 @@ > +function testChangingColorShouldUpdateColorNameDisplay(container) { > + let s = new ColorWidget(container, [255, 255, 255, 1]); > + s.show(); > + s.updateUI(); > + ok(s.colorName.textContent === "white", "Color Name should be white, ColorWidget name change failed"); We should be using is so we know the expected value. is(s.colorName.textContent, "white", "The Color Name is White"); The is() signature is is(actual, expected, message). ::: devtools/client/shared/widgets/ColorWidget.js @@ +14,1 @@ > const XHTML_NS = "http://www.w3.org/1999/xhtml"; Move XHTML_NS after the L10N declaration with a new line to separate it. @@ +344,4 @@ > }, > > destroy: function () { > this.element.removeEventListener("click", this.onElementClick); We need to set this.colorName to null in destroy() ::: devtools/shared/css/color.js @@ +175,3 @@ > return this.hex; > } > + let {r, g, b} = tuple; Add a new line after if statement block. @@ +548,5 @@ > cssRGBMap[key] = name; > } > } > } > + return cssRGBMap[JSON.stringify([r, g, b, 1])] || ""; We should update the @return {String} to indicate the name of the color or an empty string if the color does not have a name. We also need to update the JSDoc to say it doesn't throw but returns an empty string as well.
Attachment #8828993 - Flags: review?(gl)
Attached patch Bug1332085.patch v2 (obsolete) — Splinter Review
Attachment #8829139 - Flags: review?(gl)
Attachment #8828993 - Attachment is obsolete: true
Attached patch Bug1332085.patch v3 (obsolete) — Splinter Review
Attachment #8829142 - Flags: review?(gl)
Attachment #8829139 - Attachment is obsolete: true
Attachment #8829139 - Flags: review?(gl)
Attached patch Bug1332085.patch v4 (obsolete) — Splinter Review
Attachment #8829142 - Attachment is obsolete: true
Attachment #8829142 - Flags: review?(gl)
Attachment #8829143 - Flags: review?(gl)
Attachment #8829143 - Attachment is obsolete: true
Attachment #8829143 - Flags: review?(gl)
Attachment #8829144 - Flags: review?(gl)
Summary: Add Named Color to the Color Widget → Add Color Name field to Color Widget
Attachment #8829144 - Flags: review?(gl) → review+
Attachment #8865729 - Flags: review?(gl) → review+
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: