Sha256: 52d477f70620221295ce731a81bd66919be3485e3bc88a4b7c4555ecca3892ff

Contents?: true

Size: 1.34 KB

Versions: 51

Compression:

Stored size: 1.34 KB

Contents

@function deep-equal($expected) {
  $when: true;
  $actual: actual();

  $contains-list: true;
  $temp-1: $actual;
  $temp-2: $expected;

  @while $contains-list {
    $contains-list: false;

    @if length($temp-1) == length($temp-2) {
      @for $n from 1 through length($temp-1) {
        $temp-1-item: nth($temp-1, $n);
        $temp-2-item: nth($temp-2, $n);

        @if type-of($temp-1-item) == "list" and type-of($temp-2-item) == "list" {
          @if length($temp-1-item) == length($temp-2-item) {
            @for $_n from 1 through length($temp-1-item) {
              $_temp-1-item: nth($temp-1-item, $_n);
              $_temp-2-item: nth($temp-2-item, $_n);

              @if type-of($_temp-1-item) == "list" and type-of($_temp-2-item) == "list" {
                $contains-list: true;
              } @else if $_temp-1-item != $_temp-2-item {
                $when: false;
              }

              $temp-1: $_temp-1-item;
              $temp-2: $_temp-2-item;
            }
          } @else {
            $when: false;
          }
        } @else if $temp-1-item != $temp-2-item {
          $when: false;
        }
      }
    } @else {
      $when: false;
    }
  }

  $throw: error("dep", "The `deep-equal` matcher has been deprecated, please use the `be` matcher for the same functionality");

  @return should("deep equal", $expected, $when);
}

Version data entries

51 entries across 51 versions & 2 rubygems

Version Path
flint-gs-2.3.6 tests/bootcamp/dist/matchers/lists/_deep-equal.scss
flint-gs-2.3.5 tests/bootcamp/dist/matchers/lists/_deep-equal.scss
flint-gs-2.3.4 tests/bootcamp/dist/matchers/lists/_deep-equal.scss
flint-gs-2.3.3 tests/bootcamp/dist/matchers/lists/_deep-equal.scss
flint-gs-2.3.2 tests/bootcamp/dist/matchers/lists/_deep-equal.scss
flint-gs-2.3.1 tests/bootcamp/dist/matchers/lists/_deep-equal.scss
flint-gs-2.3.0 tests/bootcamp/dist/matchers/lists/_deep-equal.scss
oulu-rails-0.6.14 vendor/assets/stylesheets/bootcamp/dist/matchers/lists/_deep-equal.scss
oulu-rails-0.6.13 vendor/assets/stylesheets/bootcamp/dist/matchers/lists/_deep-equal.scss
flint-gs-2.2.0 tests/bootcamp/dist/matchers/lists/_deep-equal.scss
flint-gs-2.1.4 tests/bootcamp/dist/matchers/lists/_deep-equal.scss
oulu-rails-0.6.12 vendor/assets/stylesheets/bootcamp/dist/matchers/lists/_deep-equal.scss
oulu-rails-0.6.11 vendor/assets/stylesheets/bootcamp/dist/matchers/lists/_deep-equal.scss
oulu-rails-0.6.10 vendor/assets/stylesheets/bootcamp/dist/matchers/lists/_deep-equal.scss
oulu-rails-0.6.5 vendor/assets/stylesheets/bootcamp/dist/matchers/lists/_deep-equal.scss
oulu-rails-0.6.4 vendor/assets/stylesheets/bootcamp/dist/matchers/lists/_deep-equal.scss
oulu-rails-0.6.3 vendor/assets/stylesheets/bootcamp/dist/matchers/lists/_deep-equal.scss
oulu-rails-0.6.2 vendor/assets/stylesheets/bootcamp/dist/matchers/lists/_deep-equal.scss
oulu-rails-0.6.0 vendor/assets/stylesheets/bootcamp/dist/matchers/lists/_deep-equal.scss
oulu-rails-0.5.37 vendor/assets/stylesheets/bootcamp/dist/matchers/lists/_deep-equal.scss