added isEqual to RadioBox variations

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-08-22 13:11:35 -05:00
parent f94ddbf866
commit c40dc5e396
2 changed files with 32 additions and 1 deletions

View File

@ -31,7 +31,6 @@ public class RadioBoxModel: FormFieldModel {
case text
case subText
case subTextRight
case backgroundColor
case selected
case strikethrough
case action
@ -90,4 +89,26 @@ public class RadioBoxModel: FormFieldModel {
try container.encode(strikethrough, forKey: .strikethrough)
try container.encodeModelIfPresent(action, forKey: .action)
}
open override func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard super.isEqual(to: model), let model = model as? Self else { return false }
return text == model.text
&& subText == model.subText
&& subTextRight == model.subTextRight
&& selected == model.selected
&& strikethrough == model.strikethrough
&& fieldValue == model.fieldValue
&& action.isEqual(to: model.action)
}
open override func isVisuallyEquivalent(to model: any MoleculeModelComparisonProtocol) -> Bool {
guard super.isVisuallyEquivalent(to: model), let model = model as? Self else { return false }
return text == model.text
&& subText == model.subText
&& subTextRight == model.subTextRight
&& selected == model.selected
&& strikethrough == model.strikethrough
&& fieldValue == model.fieldValue
}
}

View File

@ -69,6 +69,16 @@ public class RadioBoxesModel: FormFieldModel {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(boxes, forKey: .boxes)
}
open override func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard super.isEqual(to: model), let model = model as? Self else { return false }
return boxes == model.boxes
}
open override func isVisuallyEquivalent(to model: any MoleculeModelComparisonProtocol) -> Bool {
guard super.isVisuallyEquivalent(to: model), let model = model as? Self else { return false }
return boxes == model.boxes
}
}
extension Array where Element == RadioBoxModel {