Skip to content

Commit

Permalink
Identified a bug that prevents the correct class to be retrieved from…
Browse files Browse the repository at this point in the history
… a rootView. To be fixed.
  • Loading branch information
rafaelnobrepd committed Jul 4, 2018
1 parent 43a8c5d commit c58bb4a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Tests/RswiftCoreTests/NibParserDelegateTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class NibParserTests: XCTestCase {
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="myCellIdentifier" rowHeight="200" id="ypE-6P-i0e">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="myCellIdentifier" rowHeight="200" id="ypE-6P-i0e" customClass="MyCell" customModule="MyTest" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="200"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="ypE-6P-i0e" id="aZO-BP-7IV">
Expand Down Expand Up @@ -70,6 +70,23 @@ class NibParserTests: XCTestCase {
}

XCTAssert(parserDelegate.rootViews.count == 1)
XCTAssert(parserDelegate.reusables.count == 1)
}

func testRootViewTypeIsCorrectlyExposed() {
guard let data = nibContents.data(using: String.Encoding.utf8) else {
return XCTFail("Unable to create nibContents")
}

let parser = XMLParser(data: data)

let parserDelegate = NibParserDelegate()
parser.delegate = parserDelegate

guard parser.parse() else {
return XCTFail("Invalid XML")
}

XCTAssert(parserDelegate.rootViews.first != Type._UIView)
}
}

0 comments on commit c58bb4a

Please sign in to comment.