@mixin assert-true()
Description
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
@include test('Non-empty strings are truthy') {
@include assert-true(
'Hello World',
'You can optionally describe the assertion...');
}
@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()
Description
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
@include test('Empty strings are falsey') {
@include assert-false(
'',
'You can optionally describe the assertion...');
}
@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()
Description
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
@include test('Division works as expected in Sass') {
@include assert-equal(
8 / 2,
4,
'You can optionally describe the assertion...');
}
@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()
Description
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
@include test('Strings and numbers hare not the same') {
@include assert-unequal(
1em,
'1em');
}
@charset "UTF-8";
/* Test: Strings and numbers hare not the same */
/* ✔ [assert-unequal] Strings and numbers hare not the same */
/* */