Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Add new assertions assertSeeEmptyTextIn() and assertDontSeeEmptyTextIn() #843

Merged
merged 2 commits into from
Dec 15, 2020

Conversation

u01jmg3
Copy link
Contributor

@u01jmg3 u01jmg3 commented Dec 13, 2020

Sometimes it is helpful to check that a selector has some text (or conversely has no text) particularly when the value of the text is dynamically populated. This means it's less about asserting what the value of the text is but rather that there is some text (i.e. the contents of the selector is not empty).

This is where assertSeeEmptyTextIn() and assertDontSeeEmptyTextIn() comes into play.

@taylorotwell
Copy link
Member

Can't you pass an empty string to assertSeeIn and assertDontSeeIn?

@u01jmg3
Copy link
Contributor Author

u01jmg3 commented Dec 13, 2020

@taylorotwell: nope, assertSeeIn() and assertDontSeeIn() both use Str::contains(). This means you cannot check if a string is empty as it will always return false (as empty needles are discarded).

dump(Str::contains('text', '')); // false

dump(Str::contains('', '')); // false

@u01jmg3
Copy link
Contributor Author

u01jmg3 commented Dec 14, 2020

@driesvints: any chance this can be looked at again? Apologies but I don't know what the procedure is for getting Taylor to take another look at a closed PR once he's made a comment.

I've given an explanation above as to why I believe assertSeeIn() and assertDontSeeIn() can't be used for checking if a selector has empty text or not. Unless I'm missing something...

@driesvints driesvints reopened this Dec 15, 2020
@driesvints
Copy link
Member

Re-opened this for Taylor to review.

@driesvints driesvints changed the title Add new assertions assertSeeEmptyTextIn() and assertDontSeeEmptyTextIn() [6.x] Add new assertions assertSeeEmptyTextIn() and assertDontSeeEmptyTextIn() Dec 15, 2020
@taylorotwell
Copy link
Member

Renamed to assertSeeAnythingIn and assertSeeNothingIn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants