capybara/node/matchers.py
def assert_style(self, styles, **kwargs):
        """
        Asserts that an element has the specified CSS styles. ::

            element.assert_style({"color": "rgb(0,0,255)", "font-size": re.compile(r"px")})

        Args:
            styles (Dict[str, str | RegexObject]): The expected styles.

        Returns:
            True

        Raises:
            ExpectationNotMet: The element doesn't have the specified styles.
        """

        query = StyleQuery(styles, **kwargs)

        @self.synchronize(wait=query.wait)
        def assert_style():
            if not query.resolves_for(self):
                raise ExpectationNotMet(query.failure_message)

            return True

        return assert_style()
def assert_style(self, styles, **kwargs):
        """
        Asserts that an element has the specified CSS styles. ::

            element.assert_style({"color": "rgb(0,0,255)", "font-size": re.compile(r"px")})

        Args:
            styles (Dict[str, str | RegexObject]): The expected styles.

        Returns:
            True

        Raises:
            ExpectationNotMet: The element doesn't have the specified styles.
        """

        query = StyleQuery(styles, **kwargs)

        @self.synchronize(wait=query.wait)
        def assert_style():
            if not query.resolves_for(self):
                raise ExpectationNotMet(query.failure_message)

            return True

        return assert_style()
def assert_style ( self , styles , * * kwargs ) : query = StyleQuery ( styles , * * kwargs ) @ self . synchronize ( wait = query . wait ) def assert_style ( ) : if not query . resolves_for ( self ) : raise ExpectationNotMet ( query . failure_message ) return True return assert_style ( )
Asserts that an element has the specified CSS styles. ::

            element.assert_style({"color": "rgb(0,0,255)", "font-size": re.compile(r"px")})

        Args:
            styles (Dict[str, str | RegexObject]): The expected styles.

        Returns:
            True

        Raises:
            ExpectationNotMet: The element doesn't have the specified styles.
Asserts that an element has the specified CSS styles . ::