From 7e44bbc0dca54e643b5eb8717930504ba1f1753e Mon Sep 17 00:00:00 2001 From: vakrilov Date: Fri, 26 Jun 2015 16:44:17 +0300 Subject: [PATCH] Fix: color and font comparers --- color/color-common.ts | 6 ++++++ ui/styling/font-common.ts | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/color/color-common.ts b/color/color-common.ts index 0de2a470c..2772a5515 100644 --- a/color/color-common.ts +++ b/color/color-common.ts @@ -94,6 +94,12 @@ export class Color implements definition.Color { } public static equals(value1: definition.Color, value2: definition.Color): boolean { + // both values are falsy + if (!value1 && !value2) { + return true; + } + + // only one is falsy if (!value1 || !value2) { return false; } diff --git a/ui/styling/font-common.ts b/ui/styling/font-common.ts index 20454269f..a5c9604e6 100644 --- a/ui/styling/font-common.ts +++ b/ui/styling/font-common.ts @@ -84,6 +84,16 @@ export class Font implements definitios.Font { } public static equals(value1: Font, value2: Font): boolean { + // both values are falsy + if (!value1 && !value2) { + return true; + } + + // only one is falsy + if (!value1 || !value2) { + return false; + } + return value1.fontFamily === value2.fontFamily && value1.fontSize === value2.fontSize && value1.fontStyle === value2.fontStyle &&