// Isolation Syntax
// ================

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

  // isolate [mixin]
  // ---------------

  @include output-test('isolate') {
    @include assert-setup($grid: 7 .5) {
      .test, .expect {
        @include span(last 2);
        clear: both;
      }
    }
    @include assert-output(
      'Item should be isolated in the last 2 columns'
    ) {
      .test { @include isolate(last 2); }
      .expect {
        float: left;
        margin-left: 75%;
        margin-right: -100%;
      }
    }
  }

  // isolate [function]
  // ------------------

  @include test('[function] isolate') {
    $test: isolate(25%);
    $expect: 25%;
    @include assert-equal($test, $expect,
      'Explicit value is passed through as isolation offset.');

    $test: isolate(2 of 7 .5 after);
    $expect: 15%;
    @include assert-equal($test, $expect,
      'Index span is calculated as isolation location.');
  }

  // get-isolation
  // -------------

  @include test('[function] get-isolation') {
    // args: $span, $location [, $columns, $gutters, $column-width, $math ]

    // explicit
    $location: 30%;
    $test: get-isolation((span: 1, location: $location));
    $expect: $location;
    @include assert-equal($test, $expect,
      'Explicit isolation placements should be passed back unchanged.');

    // first
    $test: get-isolation((span: 1, edge: first));
    $expect: 0;
    @include assert-equal($test, $expect,
      'Isolation in the first column doesnt require any prefixed margins.');

    // calculated
    $test: get-isolation((
      span: 2,
      edge: last,
      columns: 7,
      gutters: .5,
      column-width: 4em,
      math: static,
    ));
    $expect: 30em;
    @include assert-equal($test, $expect,
      'Isolation for "last 2 of 7 (4em 2em) static" (5 wide) should be 30em.');

    // split
    $test: get-isolation((
      span: 2,
      location: 1,
      columns: 8,
      gutters: .25,
      column-width: 4em,
      math: fluid,
      gutter-position: split,
    ));
    $expect: 1.25%;
    @include assert-equal($test, $expect,
      'Returns isolation value for first split element.');

    // split (0 gutters)
    $test: get-isolation((
      span: 2,
      location: 2,
      columns: 10,
      gutters: 0,
      column-width: 4em,
      math: fluid,
      gutter-position: split,
    ));
    $expect: 10%;
    @include assert-equal($test, $expect,
      'Returns isolation value for first split element.');
  }

}
