<commit_before><commit_msg>Add tests for layout mixins.<commit_after>jest.autoMockOff()

fs      = require 'fs'
path    = require 'path'
sass    = require 'node-sass'
css     = require 'css'

renderSass = (sass_source) ->
    output = sass.renderSync
                data: """
                    @import "marquee"

                    #{ sass_source }
                """
                indentedSyntax: true
                includePaths: [
                    path.join(__dirname, '..')
                ]

    parsed = css.parse(output.css.toString())
    return parsed

describe 'layout', ->
    describe 'gutter-all', ->
        it 'should use padding by default', ->
            parsed = renderSass """
                .Foo
                    +gutter-all
            """
        
            parsed.stylesheet.rules[0].declarations.forEach (declaration) ->
                expect(declaration.property.split('-')[0]).toEqual('padding')
                expect(declaration.value).toEqual('14px')

            parsed.stylesheet.rules[1...].forEach (mq_rule) ->
                expect(mq_rule.rules[0].declarations[0].property.split('-')[0]).toEqual('padding')
                expect(mq_rule.rules[0].declarations[0].value).toEqual('28px')



        it 'should apply multiplier to default values', ->
            parsed = renderSass """
                .Foo
                    +gutter-all(2)
            """

            parsed.stylesheet.rules[0].declarations.forEach (declaration) ->
                expect(declaration.value).toEqual('28px')

            parsed.stylesheet.rules[1...].forEach (mq_rule) ->
                expect(mq_rule.rules[0].declarations[0].value).toEqual('56px')



        it 'should support using margin', ->
            parsed = renderSass """
                .Foo
                    +gutter-all($padding: false)
            """
        
            parsed.stylesheet.rules[0].declarations.forEach (declaration) ->
                expect(declaration.property.split('-')[0]).toEqual('margin')
                expect(declaration.value).toEqual('14px')

            parsed.stylesheet.rules[1...].forEach (mq_rule) ->
                expect(mq_rule.rules[0].declarations[0].property.split('-')[0]).toEqual('margin')
                expect(mq_rule.rules[0].declarations[0].value).toEqual('28px')


        it 'should accept alternate sizes', ->
            parsed = renderSass """
                .Foo
                    +gutter-all($values: (1em, 2em))
            """
        
            parsed.stylesheet.rules[0].declarations.forEach (declaration) ->
                expect(declaration.property.split('-')[0]).toEqual('padding')
                expect(declaration.value).toEqual('1em')

            parsed.stylesheet.rules[1...].forEach (mq_rule) ->
                expect(mq_rule.rules[0].declarations[0].property.split('-')[0]).toEqual('padding')
                expect(mq_rule.rules[0].declarations[0].value).toEqual('2em')
{'fraction_non_alphanumeric': 0.14773495605138606, 'fraction_numerical': 0.015212981744421906, 'mean_word_length': 1.7246777163904237, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '399504', 'n_tokens_mistral': 848, 'n_tokens_neox': 815, 'n_words': 109}