-
-
Save laevandus/e32a0e4a78560ca397ae2a8716437a0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@testable import SwiftUIExampleViewInspector | |
import SwiftUI | |
import ViewInspector | |
import XCTest | |
// Do not forget this! | |
extension ContentView: Inspectable {} | |
final class ContentViewTests: XCTestCase { | |
func testInitialTitle() throws { | |
let contentView = ContentView() | |
let text = try contentView.inspect() | |
.find(text: "Hello World!") | |
let font = try text.attributes().font() | |
XCTAssertEqual(font, Font.title) | |
} | |
func testWelcomeTitle() throws { | |
let viewModel = ContentView.ViewModel() | |
viewModel.style = .welcome | |
let contentView = ContentView(viewModel: viewModel) | |
_ = try contentView.inspect().find(text: "Welcome World!") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment