// Grids Syntax
// ============

@include test-module('Grids Syntax') {

  // [mixin] layout
  // ----------------

  @include test('[mixin] layout') {
    $grid: 960px inside border-box;

    // original change
    @include layout($grid);

    @include assert-equal(susy-get(container), 960px,
      'New container setting should be "960px"');
    @include assert-equal(susy-get(columns), susy-get(columns, $susy-defaults),
      'New columns setting should still be the default');
    @include assert-equal(susy-get(box-sizing), border-box,
      'New box-sizing should be "border-box"');
    @include assert-equal(susy-get(gutter-position), inside,
      'New gutter-position should be "inside"');

    @include layout(12);

    @include assert-equal(susy-get(container), 960px,
      'New container setting should remain "960px"');
    @include assert-equal(susy-get(columns), 12,
      'New columns setting should be "12"');
    @include assert-equal(susy-get(box-sizing), border-box,
      'New box-sizing should remain "border-box"');

    @include original-grid;
  }

  // [mixin] with-layout
  // -------------------

  @include test('[mixin] with-layout') {
    @include layout((
      columns: 4,
      container: 960px
    ));

    @include assert-equal(susy-get(columns), 4,
      'Start with 4 columns, before with-layout');
    @include assert-equal(susy-get(container), 960px,
      'Start with 960px container, before with-layout');

    @include with-layout(auto 12) {
      @include assert-equal(susy-get(columns), 12,
        'Switch to 12 columns, inside with-layout');
      @include assert-equal(susy-get(container), auto,
        'Switch to auto container, inside with-layout');
    }

    @include assert-equal(susy-get(columns), susy-get(columns, $susy-defaults),
      'End with 4 columns, after with-layout');
    @include assert-equal(susy-get(container), 960px,
      'End with 960px container, after with-layout');

    @include original-grid;
  }

  // [function] layout
  // -----------------

  @include test('[function] layout') {
    $shorthand: 8 .5 inside static overlay;
    $test: layout($shorthand);
    $expect: (
      columns: 8,
      gutters: .5,
      gutter-position: inside,
      math: static,
      debug: ( output: overlay ),
    );
    @include assert-equal($test, $expect,
      'Returns a parsed grid map based on shorthand syntax');
  }

  // [function] _get-layout
  // ----------------------

  @include test('[function] _get-layout') {
    @include with-layout(show-baseline, clean) {
      $test: _get-layout(overlay);
      $expect: (
        debug: (
          image: show-baseline,
          output: overlay,
        )
      );
      @include assert-equal($test, $expect,
        'Returns layout merged with global settings');

      $test: _get-layout(overlay, clean);
      $expect: (
        debug: (output: overlay)
      );
      @include assert-equal($test, $expect,
        'Returns layout, without global settings');
    }
  }

}
