True 4.0.0

@mixin assert-true()

Assert that a parameter is truthy.

  • Empty lists and strings are excluded from default Sass truthyness. Assertions are used inside the test() mixin

Parameters

$assert: (*)

Asserted value to test

$description: null (string)

Description of the assertion being tested. A null of false value generates a default description.

Example

scss
@include test('Non-empty strings are truthy') {
  @include assert-true(
    'Hello World',
    'You can optionally describe the assertion...');
}
css compiled
@charset "UTF-8";
/* Test: Non-empty strings are truthy */
/*   ✔ [assert-true] You can optionally describe the assertion... */
/*  */

Requires

@mixin _true-context() [private]

@mixin _true-assert-results() [private]

@function _true-context() [private]

@function _true-is-truthy() [private]

@mixin assert-false()

Assert that a parameter is falsey.

  • Empty lists and strings are added to default Sass falseyness. to define the expected results of the test.

Parameters

$assert: (*)

Asserted value to test

$description: null (string)

Description of the assertion being tested. A null of false value generates a default description.

Example

scss
@include test('Empty strings are falsey') {
  @include assert-false(
    '',
    'You can optionally describe the assertion...');
}
css compiled
@charset "UTF-8";
/* Test: Empty strings are falsey */
/*   ✔ [assert-false] You can optionally describe the assertion... */
/*  */

Requires

@mixin _true-context() [private]

@mixin _true-assert-results() [private]

@function _true-context() [private]

@function _true-is-truthy() [private]

@mixin assert-equal()

Assert that two parameters are equal Assertions are used inside the test() mixin to define the expected results of the test.

Parameters

$assert: (*)

Asserted value to test

$expected: (*)

Expected match

$description: null (string)

Description of the assertion being tested (a null of false value generates a default description)

$inspect: false (bool)

Optionally compare inspected values (useful for comparing CSS output rather than Sass values)

Example

scss
@include test('Division works as expected in Sass') {
  @include assert-equal(
    8 / 2,
    4,
    'You can optionally describe the assertion...');
}
css compiled
@charset "UTF-8";
/* Test: Division works as expected in Sass */
/*   ✔ [assert-equal] You can optionally describe the assertion... */
/*  */

Requires

@mixin _true-context() [private]

@mixin _true-assert-results() [private]

@function _true-context() [private]

@mixin assert-unequal()

Assert that two parameters are unequal Assertions are used inside the test() mixin to define the expected results of the test.

Parameters

$assert: (*)

Asserted value to test

$expected: (*)

Expected mismatch

$description: null (string)

Description of the assertion being tested. A null of false value generates a default description.

$inspect: false (bool)

Optionally compare inspected values (useful for comparing CSS output rather than Sass values)

Example

scss
@include test('Strings and numbers hare not the same') {
  @include assert-unequal(
    1em,
    '1em');
}
css compiled
@charset "UTF-8";
/* Test: Strings and numbers hare not the same */
/*   ✔ [assert-unequal] Strings and numbers hare not the same */
/*  */

Requires

@mixin _true-context() [private]

@mixin _true-assert-results() [private]

@function _true-context() [private]