|
19 | 19 | import Core |
20 | 20 | import XCTest |
21 | 21 |
|
22 | | -class InsertStudioOpenDetailViewButtonTests: XCTestCase { |
| 22 | +class InsertStudioOpenInDetailButtonsTests: XCTestCase { |
23 | 23 |
|
24 | 24 | func testInsertion() { |
25 | 25 | let mockLinkDelegate = MockCoreWebViewLinkDelegate() |
@@ -90,45 +90,4 @@ class InsertStudioOpenDetailViewButtonTests: XCTestCase { |
90 | 90 |
|
91 | 91 | wait(for: [exp]) |
92 | 92 | } |
93 | | - |
94 | | - func testFontSizeCSSProperty() { |
95 | | - let mockLinkDelegate = MockCoreWebViewLinkDelegate() |
96 | | - let webView = CoreWebView(features: [.insertStudioOpenInDetailButtons]) |
97 | | - webView.linkDelegate = mockLinkDelegate |
98 | | - webView.loadHTMLString("<div>Test</div>") |
99 | | - wait(for: [mockLinkDelegate.navigationFinishedExpectation], timeout: 10) |
100 | | - |
101 | | - let expectedFontSize = UIFont.scaledNamedFont(.regular14).pointSize |
102 | | - |
103 | | - let jsEvaluated = expectation(description: "JS evaluated") |
104 | | - |
105 | | - let extractCSSScript = """ |
106 | | - (function() { |
107 | | - const styles = document.head.querySelectorAll('style'); |
108 | | - for (let style of styles) { |
109 | | - const css = style.innerHTML; |
110 | | - if (css.includes('open_details_button')) { |
111 | | - const match = css.match(/\\.open_details_button\\s*\\{[^}]*font-size:\\s*([\\d.]+)px/); |
112 | | - return match ? match[1] : null; |
113 | | - } |
114 | | - } |
115 | | - return null; |
116 | | - })() |
117 | | - """ |
118 | | - |
119 | | - webView.evaluateJavaScript(extractCSSScript) { result, error in |
120 | | - defer { jsEvaluated.fulfill() } |
121 | | - |
122 | | - XCTAssertNil(error) |
123 | | - guard let fontSizeString = result as? String, |
124 | | - let actualFontSize = Double(fontSizeString) else { |
125 | | - XCTFail("Could not extract font-size value from CSS") |
126 | | - return |
127 | | - } |
128 | | - |
129 | | - XCTAssertEqual(actualFontSize, expectedFontSize, accuracy: 0.01, "Font size in CSS should match UIFont.scaledNamedFont(.regular14).pointSize") |
130 | | - } |
131 | | - |
132 | | - wait(for: [jsEvaluated], timeout: 10) |
133 | | - } |
134 | 93 | } |
0 commit comments