Permalink
Browse files

Clear text field upon save

We hook up an action to the save button to clear out the text field when it's tapped.

Now our feature test makes it all the way to the final assertion. The test is looking for the new message to appear somewhere on screen, but it doesn't:

Red: NoMatchingElementException. accessibilityLabel('New message')
  • Loading branch information...
CodingItWrong committed Jan 2, 2018
1 parent 352589d commit 860ef427f4fef1f27301a75ad6a962b41e286e37
@@ -36,6 +36,9 @@
<accessibilityTraits key="traits" button="YES"/>
</accessibility>
<state key="normal" title="Save"/>
<connections>
<action selector="save" destination="3xp-yl-5MK" eventType="touchUpInside" id="qN2-8P-8Wq"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -55,6 +58,9 @@
<outlet property="delegate" destination="3xp-yl-5MK" id="jGL-fJ-sZ4"/>
</connections>
</tableView>
<connections>
<outlet property="messageTextField" destination="OZZ-xr-cgC" id="Gc1-w2-ATl"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="51D-tk-gZd" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
@@ -1,5 +1,9 @@
import UIKit
class MessagesViewController: UITableViewController {
@IBOutlet var messageTextField: UITextField!
@IBAction func save() {
messageTextField.text = ""
}
}

0 comments on commit 860ef42

Please sign in to comment.