Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Colorpicker adjustments #1227

Merged
merged 8 commits into from
Oct 26, 2017
Merged

Colorpicker adjustments #1227

merged 8 commits into from
Oct 26, 2017

Conversation

Blackbaud-SteveBrush
Copy link
Member

Addresses:
#1128
#1178
#1175
#1173

@codecov-io
Copy link

codecov-io commented Oct 20, 2017

Codecov Report

Merging #1227 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1227   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files         355     355           
  Lines        6620    6620           
  Branches      853     853           
======================================
  Hits         6620    6620
Impacted Files Coverage Δ
...modules/colorpicker/colorpicker-input.directive.ts 100% <100%> (ø) ⬆️
src/modules/colorpicker/colorpicker.component.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c39ed52...483605f. Read the comment docs.

@@ -100,6 +101,10 @@ export class SkyColorpickerInputDirective
}

public ngOnInit() {
if (this.initialColor === undefined) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you're trying to prevent initialColor from being undefined, but doing so here only prevents it before ngOnInit and not during subsequent rounds of change detection. What I would suggest is using a property setter that checks for undefined and then sets the property to the default color in that case. Then it won't matter when it's set.

// Outside the class declaration
const DEFAULT_COLOR = '#FFFFFF';

@Input()
public set initialColor(value: string) {
  this._initialColor = value || DEFAULT_COLOR;
}

public get initialColor(): string {
  return this._initialColor;
}

private _initialColor = DEFAULT_COLOR;

@Blackbaud-SteveBrush Blackbaud-SteveBrush merged commit a65a8a4 into master Oct 26, 2017
@Blackbaud-SteveBrush Blackbaud-SteveBrush deleted the fix-colorpicker branch October 26, 2017 18:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants