Skip to content

Commit

Permalink
Fix the TextStyle Equatable bug failing the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mayur8657 committed Feb 12, 2019
1 parent 8b4119d commit 566cbd0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Form/TextStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ public extension TextStyle {
var style = ((self.attribute(for: .paragraphStyle) as NSParagraphStyle?)?.mutableCopy() as? NSMutableParagraphStyle) ?? NSMutableParagraphStyle()
update(&style)
attributes[.paragraphStyle] = style

if equatableForAttribute[.paragraphStyle] == nil {
equatableForAttribute[.paragraphStyle] = { $0 as! NSMutableParagraphStyle == $1 as! NSMutableParagraphStyle }
}

}

/// Register a custom `transfrom` for `attribute`
Expand All @@ -159,7 +164,7 @@ extension TextStyle: Equatable {
}

for (attribute, left) in lhs.attributes {
guard let right = rhs.attributes[attribute], attribute != .paragraphStyle else {
guard let right = rhs.attributes[attribute] else {
return false
}

Expand Down

0 comments on commit 566cbd0

Please sign in to comment.