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

Issue when testing for multiple media queries #25

Open
peterramsing opened this issue Jun 4, 2016 · 1 comment
Open

Issue when testing for multiple media queries #25

peterramsing opened this issue Jun 4, 2016 · 1 comment

Comments

@peterramsing
Copy link
Contributor

I am struggling to test whether or not a second media query is created within a mixin.

This may be user error, so please let me know if I'm testing this incorrectly.

I'm working on getting this working and will get a PR together if I'm able to figure something out.

Here's the scss:

@mixin helper--center-image-outside-bounds(
    $max-width,
    $medium-max-width: null,
    $large-max-width: null
    ) {

    left: 50%;
    margin-left: margin-left-math($max-width);
    max-width: $max-width;
    overflow: hidden;
    position: relative;

    @if $medium-max-width {
        @media #{$tablet} {
            margin-left: margin-left-math($medium-max-width);
            max-width: $medium-max-width;
        }
    }

    @if $large-max-width {
        @media #{$desktop} {
            margin-left: margin-left-math($large-max-width);
            max-width: $large-max-width;
        }
    }
}

I am able to test whether or not the first media query is created when both are created but because L86 of parsers.js only passes the first (0) value of the array I'm unable to determine if the second media query was created.

Here's the test:

...
it("Creates a media query when large size is declared", function() {
     sassaby.includedMixin('helper--center-image-outside-bounds').calledWithArgs('1000px', '2000px', '3000px').createsMediaQuery('(min-width: 900px)');
});
...
peterramsing referenced this issue in peterramsing/sassaby Jun 4, 2016
Here’s a hacked thought process for adding support for searching
multiple media queries. Just a thought process and not intended for
release
@peterramsing
Copy link
Contributor Author

@ryanbahniuk I hacked something together for a direction if you had any thoughts on it. Emphasis on a hack. Just an idea really...

peterramsing@d42ed62

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

No branches or pull requests

1 participant