From 5041313307888c3b5fb2e3d2caf6619ae66c141d Mon Sep 17 00:00:00 2001 From: Sebastien Armand Date: Mon, 15 Oct 2012 19:54:25 +0800 Subject: [PATCH] Mink can now check that an element does not contain the given HTML --- src/Behat/MinkExtension/Context/MinkContext.php | 10 ++++++++++ src/Behat/MinkExtension/Context/MinkDictionary.php | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/Behat/MinkExtension/Context/MinkContext.php b/src/Behat/MinkExtension/Context/MinkContext.php index c29de8c..01812c9 100644 --- a/src/Behat/MinkExtension/Context/MinkContext.php +++ b/src/Behat/MinkExtension/Context/MinkContext.php @@ -317,6 +317,16 @@ class MinkContext extends RawMinkContext implements TranslatedContextInterface $this->assertSession()->elementContains('css', $element, $this->fixStepArgument($value)); } + /** + * Checks, that element with specified CSS doesn't contain specified HTML. + * + * @Then /^the "(?P[^"]*)" element should not contain "(?P(?:[^"]|\\")*)"$/ + */ + public function assertElementNotContains($element, $value) + { + $this->assertSession()->elementNotContains('css', $element, $this->fixStepArgument($value)); + } + /** * Checks, that element with specified CSS exists on page. * diff --git a/src/Behat/MinkExtension/Context/MinkDictionary.php b/src/Behat/MinkExtension/Context/MinkDictionary.php index abe096f..8161aa0 100644 --- a/src/Behat/MinkExtension/Context/MinkDictionary.php +++ b/src/Behat/MinkExtension/Context/MinkDictionary.php @@ -383,6 +383,16 @@ trait MinkDictionary $this->assertSession()->elementContains('css', $element, $this->fixStepArgument($value)); } + /** + * Checks, that element with specified CSS doesn't contain specified HTML. + * + * @Then /^the "(?P[^"]*)" element should not contain "(?P(?:[^"]|\\")*)"$/ + */ + public function assertElementNotContains($element, $value) + { + $this->assertSession()->elementNotContains('css', $element, $this->fixStepArgument($value)); + } + /** * Checks, that element with specified CSS exists on page. *