From b6666ed2b01f2459eacebed8b57815deadd6eec1 Mon Sep 17 00:00:00 2001 From: Norman Basham Date: Sun, 31 Jan 2021 23:02:15 -0800 Subject: [PATCH] Added test for web colors. --- Sources/BlackLabsSwiftUIColor/BlackLabsSwiftUIColor.swift | 2 +- .../BlackLabsSwiftUIColorTests.swift | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Sources/BlackLabsSwiftUIColor/BlackLabsSwiftUIColor.swift b/Sources/BlackLabsSwiftUIColor/BlackLabsSwiftUIColor.swift index 847e024..971386b 100644 --- a/Sources/BlackLabsSwiftUIColor/BlackLabsSwiftUIColor.swift +++ b/Sources/BlackLabsSwiftUIColor/BlackLabsSwiftUIColor.swift @@ -188,7 +188,7 @@ public extension UIColor { return cssName } - fileprivate static let cssToHexDictionairy: [String: String] = [ + internal static let cssToHexDictionairy: [String: String] = [ "CLEAR": "00000000", "TRANSPARENT": "00000000", "": "00000000", diff --git a/Tests/BlackLabsSwiftUIColorTests/BlackLabsSwiftUIColorTests.swift b/Tests/BlackLabsSwiftUIColorTests/BlackLabsSwiftUIColorTests.swift index 87ca26e..70a26cb 100644 --- a/Tests/BlackLabsSwiftUIColorTests/BlackLabsSwiftUIColorTests.swift +++ b/Tests/BlackLabsSwiftUIColorTests/BlackLabsSwiftUIColorTests.swift @@ -27,6 +27,10 @@ final class BlackLabsSwiftUIColorTests: XCTestCase { } XCTAssertNotNil(Color.random) + + for (name, hex) in UIColor.cssToHexDictionairy { + XCTAssertNotNil(Color(hex: hex), "Unable to resolve color for web color: '\(name)'.") + } } static var allTests = [