No longer accepts the $formats
parameter
+
+- BREAKING: No longer accepts the
$formats
parameter
+
diff --git a/sass/core/_parser.scss b/sass/core/_parser.scss
index 6acfca3e..71ee7e09 100644
--- a/sass/core/_parser.scss
+++ b/sass/core/_parser.scss
@@ -11,6 +11,10 @@
/// You can do the same, or use it directly
/// to turn any arbitrary map into an accoutrement map.
///
+/// @since 1.0.0 -
+/// - NEW: Accepts `$do` map argument,
+/// for on-the-fly adjustments
+///
/// @group core-get
/// @example scss - Access a map directly
/// $map: (
@@ -33,14 +37,18 @@
/// A map of token definitions to reference against
/// @param {*} $key -
/// The original key or value to be parsed for `#alias` tags
+/// @param {map | null} $do [null] -
+/// A final map of function/ratio adjustments to run on the returned value
/// @return {*} -
/// The parsed value of any key in a given map
@function get-token(
$map,
- $key
+ $key,
+ $do: null
) {
$key: map-get($map, $key) or $key;
- @return _a_get($map, $key);
+ $key: _a_get($map, $key);
+ @return _a_do-each($map, $key, $do);
}
@@ -87,11 +95,7 @@
$value: _a_parse($map, $value);
// make any necessary adjustments…
- @if ($do) {
- @each $name, $args in $do {
- $value: _a_do($map, $name, $value, $args...)
- }
- }
+ $value: _a_do-each($map, $value, $do);
@return $value;
}
@@ -211,6 +215,34 @@
}
+// Do Each
+// -------
+/// A wrapper for calling `_a_do()`
+/// over each item in an adjustments list.
+///
+/// @access private
+///
+/// @param {map} $map -
+/// A map of terms to reference tags against
+/// @param {*} $value -
+/// The value to be manipulated
+/// @param {map | null} $do [null] -
+/// A map of function/ratio adjustments to run on the returned value
+@function _a_do-each(
+ $map,
+ $value,
+ $do: null
+) {
+ @if ($do) {
+ @each $name, $args in $do {
+ $value: _a_do($map, $name, $value, $args...);
+ }
+ }
+
+ @return $value;
+}
+
+
// Do
// --
/// Applies any ratio or function adjustments
diff --git a/sass/core/_ratios.scss b/sass/core/_ratios.scss
index bbfa926f..294b2c06 100644
--- a/sass/core/_ratios.scss
+++ b/sass/core/_ratios.scss
@@ -33,6 +33,10 @@ $ratios: () !default;
/// from either the `$_DEFAULT-RATIOS`
/// or user `$ratios` configurations.
///
+/// @since 1.0.0 -
+/// - NEW: Accepts `$do` map argument,
+/// for on-the-fly adjustments
+///
/// @group core-scale
/// @example scss
/// /* Octave: #{ratio('octave')} */
@@ -40,13 +44,16 @@ $ratios: () !default;
///
/// @param {string | number} $ratio -
/// The key-name or value of a ratio
+/// @param {map | null} $do [null] -
+/// A map of function/ratio adjustments to run on the returned value
/// @return {number} -
/// The numeric value of a ratio
@function ratio(
- $ratio
+ $ratio,
+ $do: null
) {
$_ratio-options: map-merge($_a_RATIOS, $ratios);
- @return get-token($_ratio-options, $ratio);
+ @return get-token($_ratio-options, $ratio, $do);
}
diff --git a/sass/core/_register.scss b/sass/core/_register.scss
index 95b123c5..f4c5236d 100644
--- a/sass/core/_register.scss
+++ b/sass/core/_register.scss
@@ -30,8 +30,8 @@
/// ```
///
/// @since 0.1.0 -
-/// Supports the [core](core.html) map-refernece syntax,
-/// for creating function aliases
+/// - NEW: Supports the [core](core.html) map-refernece syntax,
+/// for creating function aliases
///
/// @group core-register
/// @type map
diff --git a/sass/core/_strings.scss b/sass/core/_strings.scss
index d0b59ad2..79c35eb2 100644
--- a/sass/core/_strings.scss
+++ b/sass/core/_strings.scss
@@ -15,6 +15,10 @@
/// but is available in all accoutrement maps
/// under the `'str-replace'` alias.
///
+/// @since 1.0.0 -
+/// - NEW: Improved handling of non-string values,
+/// allows you to replace a number within a string, for example
+///
/// @access public
/// @name str-replace
/// @group core-strings
@@ -45,6 +49,7 @@
) {
$return: $string;
+ // Loops lists
@if (type-of($string) == 'list') {
$return: _a_list-template($string);
@each $item in $string {
@@ -54,19 +59,31 @@
@return $return;
}
+ // Force $old to string
+ $old: if($old and (type-of($old) == 'string'), $old, '#{$old}');
+ $string: if((type-of($string) == 'string'), $string, '#{$string}');
+
+ // get length and index
$i: str-index($string, $old);
$n: str-length($old);
+ // replace…
@if $string == $old {
$return: $new;
} @else if $i {
+ // Force $new & $string to string
+ $new: if((type-of($new) == 'string') or (not $new), $new, '#{$new}');
+
+ // before and after…
$a: if($i > 1, str-slice($string, 1, $i - 1), '');
$z: str-slice($string, $i + $n);
+ // recurion if needed…
@if $replace-all {
$z: _a_str-replace($z, $old, $new, true);
}
+ // re-compile…
$return: $a + if($new, $new, '') + $z;
}
@@ -216,7 +233,7 @@
/// under the `'trim'` alias.
///
/// @since 1.0.0 -
-/// Trim whitespace from the start and end of strings
+/// - NEW: Strips whitespace
///
/// @access public
/// @name trim
diff --git a/sass/plugin/animate/_change.scss b/sass/plugin/animate/_change.scss
index 927bc129..df3c30f4 100644
--- a/sass/plugin/animate/_change.scss
+++ b/sass/plugin/animate/_change.scss
@@ -53,16 +53,23 @@ $changes: () !default;
// -----------------
/// Access a named change in your `$changes` map.
///
+/// @since 1.0.0 -
+/// - NEW: Accepts `$do` map argument,
+/// for on-the-fly adjustments
+///
/// @group animate-change
///
/// @param {string} $name -
-/// The name of a change in your configuration (e.g. `fade-in`).
+/// The name of a change in your configuration (e.g. `fade-in`)
+/// @param {map | null} $do [null] -
+/// A map of function/ratio adjustments to run on the returned value
/// @return {length} -
/// The change value requested
@function change(
- $name
+ $name,
+ $do: null
) {
- @return get-token($changes, $name);
+ @return get-token($changes, $name, $do);
}
@include _a_register-function('change');
diff --git a/sass/plugin/animate/_easing.scss b/sass/plugin/animate/_easing.scss
index 96875a41..ebdf1d3b 100644
--- a/sass/plugin/animate/_easing.scss
+++ b/sass/plugin/animate/_easing.scss
@@ -82,18 +82,25 @@ $_a_EASING: (
// ---------------
/// Access a named easing function in your `$easing` map.
///
+/// @since 1.0.0 -
+/// - NEW: Accepts `$do` map argument,
+/// for on-the-fly adjustments
+///
/// @group animate-ease
///
/// @param {string} $name [ease] -
/// The name of an easing in your configuration
+/// @param {map | null} $do [null] -
+/// A map of function/ratio adjustments to run on the returned value
/// @return {length} -
/// The pre-defined easing
@function ease(
- $name: ease
+ $name: ease,
+ $do: null
) {
$map: map-merge($_a_EASING, $easing);
- $name: get-token($map, $name);
- @return unquote($name);
+ $name: get-token($map, $name, $do);
+ @return if((type-of($name) == 'string'), unquote($name), $name);
}
@include _a_register-function('ease');
diff --git a/sass/plugin/animate/_times.scss b/sass/plugin/animate/_times.scss
index 545f6528..83d5a727 100644
--- a/sass/plugin/animate/_times.scss
+++ b/sass/plugin/animate/_times.scss
@@ -38,16 +38,24 @@ $times: () !default;
// ---------------
/// Access a named time in your `$times` map.
///
+/// @since 1.0.0 -
+/// - NEW: Accepts `$do` map argument,
+/// for on-the-fly adjustments
+///
/// @group animate-times
///
/// @param {string} $time -
/// The name of a time in your configuration
+/// @param {map | null} $do [null] -
+/// A map of function/ratio adjustments to run on the returned value
/// @return {length} -
/// The calculated length of time
@function time(
- $time
+ $time,
+ $do: null
) {
- @return get-token($times, $time);
+ $time: get-token($times, $time, $do);
+ @return if((type-of($time) == 'string'), unquote($time), $time);
}
@include _a_register-function('time');
diff --git a/sass/plugin/color/_api.scss b/sass/plugin/color/_api.scss
index 2c997706..3cab985f 100644
--- a/sass/plugin/color/_api.scss
+++ b/sass/plugin/color/_api.scss
@@ -14,6 +14,10 @@
/// It has access to the global `$colors` map by default,
/// but you can also pass in arbitrary color-palette maps as well.
///
+/// @since 1.0.0 -
+/// - BREAKING: Accepts `$do` argument
+/// between `$color` and `$palette`
+///
/// @group color-api
/// @example scss
/// $colors: (
@@ -26,12 +30,13 @@
/// color: color('text');
/// }
///
-/// @parameter {string | list} $color -
+/// @param {string | list} $color -
/// The name of a color in your palette,
/// or a color description in the
/// [map configuration format](config.html).
-///
-/// @parameter {map} $palette [$colors] -
+/// @param {map | null} $do [null] -
+/// A map of function/ratio adjustments to run on the returned value
+/// @param {map} $palette [$colors] -
/// Optional map containing the source color-palette.
/// Defaults to the global `$colors` map.
///
@@ -40,7 +45,8 @@
/// based on your global color palette and adjustments.
@function color(
$color,
+ $do: null,
$palette: $colors
) {
- @return get-token($palette, $color);
+ @return get-token($palette, $color, $do);
}
diff --git a/sass/plugin/color/_config.scss b/sass/plugin/color/_config.scss
index de515ccd..6f6fbf8c 100644
--- a/sass/plugin/color/_config.scss
+++ b/sass/plugin/color/_config.scss
@@ -33,8 +33,8 @@
/// They default to `white` and `black` respectively.
///
/// @since 0.1.0 -
-/// Uses the new [shared](core.html) map syntax,
-/// for internal references and adjustments
+/// - BREAKING: Uses the new [shared](core.html) map syntax,
+/// for internal references and adjustments
///
/// @group color-api
/// @example scss - simple color definitions
diff --git a/sass/plugin/layout/_queries.scss b/sass/plugin/layout/_queries.scss
index 60a9ca64..54450afd 100644
--- a/sass/plugin/layout/_queries.scss
+++ b/sass/plugin/layout/_queries.scss
@@ -13,8 +13,8 @@
/// Otherwise, the map should contain only valid CSS length values.
///
/// @since 0.1.0 -
-/// Uses the new [shared](core.html) map syntax,
-/// for internal references and adjustments
+/// - BREAKING: Uses the new [shared](core.html) map syntax,
+/// for internal references and adjustments
///
/// @group layout-queries
/// @example scss - defining breakpoints
@@ -37,28 +37,32 @@ $breakpoints: () !default;
/// Return a breakpoint from the `$breakpoint` map,
/// or the accoutrement-scale `$sizes` map if it's available.
///
+/// @since 1.0.0 -
+/// - NEW: Accepts `$do` map argument,
+/// for on-the-fly adjustments
+///
/// @group layout-queries
///
/// @param {string} $break -
/// The name or value of a breakpoint
+/// @param {map | null} $do [null] -
+/// A map of function/ratio adjustments to run on the returned value
/// @return {length} -
/// The retrieved value of a named breakpoint
@function break(
- $break
+ $break,
+ $do: null
) {
- // already valid
- @if (type-of($break) == 'number') and not unitless($break) {
- @return $break;
- }
-
- // get breakpoint from sources
+ // gather sources
$scale: variable-exists('sizes') and (type-of($sizes) == 'map');
$source: if($scale, map-merge($sizes, $breakpoints), $breakpoints);
- $break: get-token($source, $break);
+
+ // get breakpoint
+ $break: get-token($source, $break, $do);
// validate
@if type-of($break) != 'number' or unitless($break) {
- @error '"#{$break}" isn’t a valid length or keyword.';
+ @error '"#{$break}" isn’t a valid length or keyword for `break()`';
}
@return $break;
diff --git a/sass/plugin/layout/_ratio.scss b/sass/plugin/layout/_ratio.scss
index 14b58160..a827e6b5 100644
--- a/sass/plugin/layout/_ratio.scss
+++ b/sass/plugin/layout/_ratio.scss
@@ -7,8 +7,8 @@
/// Establsih a fluid-height container based on an aspect ratio.
///
/// @since 0.1.0 -
-/// Uses the new [shared](core.html) map syntax,
-/// and [ratio](core-ratios.html) settings
+/// - BREAKING: Uses the new [shared](core.html) map syntax,
+/// and [ratio](core-ratios.html) settings
///
/// @group layout-ratios
///
@@ -41,8 +41,8 @@
/// based on a given ratio and fluid width.
///
/// @since 0.1.0 -
-/// Uses the new [shared](core.html) map syntax,
-/// and [ratio](core-ratios.html) settings
+/// - BREAKING: Uses the new [shared](core.html) map syntax,
+/// and [ratio](core-ratios.html) settings
///
/// @group layout-ratios
/// @example scss
diff --git a/sass/plugin/scale/_size.scss b/sass/plugin/scale/_size.scss
index 92c148ab..d1a186d7 100644
--- a/sass/plugin/scale/_size.scss
+++ b/sass/plugin/scale/_size.scss
@@ -7,29 +7,36 @@
/// Access a named size in your `$sizes` map,
/// using any comparable units.
///
+/// @since 1.0.0 -
+/// - BREAKING: The previous `$units…` vararg
+/// has been replaced with `$do` map argument,
+/// for flexible on-the-fly adjustments.
+/// Non-map `$do` values are converted to
+/// `('convert-units': $do)` before processing,
+/// to provide a shortcut for unit-conversions.
+/// `size('root', 'cm')` will continue to work,
+/// but `size('root', 'em', 10px)` should be changed to
+/// `size('root', 'em' 10px)` (with all unit args in a single list)
+///
/// @group scale-sizes
///
-/// @param {string | length | list} $size -
-/// The name of a size in your configuration (e.g. `line-height`),
-/// or a length to be converted into different units (e.g. `24px`),
-/// or a base-size and adjustments to be made
-/// (e.g. `24px ('minor-third': 2)`),
-/// or a `calc(%s + %s) ('root', 'rhythm')` recipie
-/// for building `calc` values.
-/// For the sake of consistent documentation,
-/// I recommend keeping adjustments in the configuration
-/// whenever possible.
-/// @param {vararg} $unit... -
-/// The desired unit for the output (e.g. `px` or `rem`),
-/// and any other arguments required for the conversion.
+/// @param {string} $size -
+/// The name of any size in your configuration
+/// @param {map | unit-args | null} $do [null] -
+/// A map of function/ratio adjustments to run on the returned value,
+/// or a unit followed by any necessary arguments
+/// for conversion
/// @return {length} -
/// The calculated length, in the requested units.
@function size(
$size,
- $unit...
+ $do: null
) {
- $size: get-token($sizes, $size);
- $size: if(length($unit) > 0, convert-units($size, $unit...), $size);
+ @if ($do) and (type-of($do) != 'map') {
+ $do: ('to': $do);
+ }
+
+ $size: get-token($sizes, $size, $do);
@return $size;
}
diff --git a/sass/plugin/scale/_units.scss b/sass/plugin/scale/_units.scss
index 336722bf..d3b98896 100644
--- a/sass/plugin/scale/_units.scss
+++ b/sass/plugin/scale/_units.scss
@@ -72,9 +72,12 @@
/// You can also convert to `browser-ems`,
/// relative to the browser default rather than the site root –
/// useful for media queries.
-/// Aliased as `convert-units`, `convert`, or `units`
+/// Aliased as `convert-units`, `convert`, `units`, and `to`
/// in all Accoutrement maps.
///
+/// @since 1.0.0 -
+/// - NEW: Aliased as `to` in accoutrement-maps
+///
/// @group scale-units
///
/// @param {length | string} $length -
@@ -179,4 +182,4 @@
@error 'Failed to convert #{$length} into #{$to-units}.';
}
-@include _a_register-function('convert-units', 'convert', 'units');
+@include _a_register-function('convert-units', 'convert', 'units', 'to');
diff --git a/sass/plugin/scale/_utility.scss b/sass/plugin/scale/_utility.scss
deleted file mode 100644
index 2fb00c3d..00000000
--- a/sass/plugin/scale/_utility.scss
+++ /dev/null
@@ -1,47 +0,0 @@
-// Utilities
-// =========
-
-
-// Format String
-// -------------
-/// Define your own format-string
-/// for building `calc(%s + %s) ('root', 'rhythm')` recipies.
-///
-/// @access private
-/// @group config
-/// @type string
-///
-/// @example scss -
-/// $ac-format-string: '@@@';
-$ac-format-string: '%s';
-
-
-// Interpolate
-// -----------
-/// Return a string with interpolated values
-/// replacing `%s` format strings
-///
-/// @access private
-///
-/// @param {string} $string -
-/// The original string to be edited
-/// @param {strings} $values... -
-/// New strings, to replace the `%s` format strings
-/// @return {string} -
-/// Original string, with `%s` format strings replaced
-@function _a_interpolate(
- $string,
- $values...
-) {
- $_return: $string;
-
- @each $val in $values {
- @if str-index($_return, $ac-format-string) {
- $_return: _a_str-replace($_return, $ac-format-string, $val);
- } @else {
- @warn 'Too many values passed for interpolation with "#{$string}".';
- }
- }
-
- @return $_return;
-}
diff --git a/sass/plugin/type/_config.scss b/sass/plugin/type/_config.scss
index b75511f3..95931dbb 100644
--- a/sass/plugin/type/_config.scss
+++ b/sass/plugin/type/_config.scss
@@ -35,8 +35,8 @@
/// long and repetative paths for every font.
///
/// @since type-4.0.0 -
-/// The default changed from `'../fonts/'` to `''` --
-/// so that no path is added unless explicity requested.
+/// - BREAKING: The default changed from `'../fonts/'` to `''` --
+/// so that no path is added unless explicity requested.
///
/// @group type-fonts
/// @example scss
@@ -66,23 +66,23 @@ $font-path: '' !default;
/// it will include `source` links in the output.
///
/// @since 0.1.0 -
-/// - Supports `'bold italic'` weight/style syntax
+/// - NEW: Supports `'bold italic'` weight/style syntax
/// in addition to `('bold', 'italic')`
-/// - Full support for the [core](core.html) map-reference syntax,
+/// - BREAKING: Full support for the [core](core.html) map-reference syntax,
/// not just font-name alias reference
/// @since type-4.0.0 -
-/// - Remove the `$font-formats` variable,
+/// - BREAKING: Remove the `$font-formats` variable,
/// and replaced it with a `formats` property
/// in each individual font map
-/// - No longer accepts `regular` as a font-variant,
+/// - BREAKING: No longer accepts `regular` as a font-variant,
/// use the CSS-friendly `normal` instead
-/// - Allow explicit configuration maps for each font variant,
+/// - NEW: Allow explicit configuration maps for each font variant,
/// to support variant-specific `local` and `svgid` options,
/// along with the ability to specificy
/// explicit urls for each format desired
/// The old string value will be treated the same as
/// a map with only `'path'` defined
-/// - Supports `unicode-range` CSS property,
+/// - NEW: Supports `unicode-range` CSS property,
/// as [described on MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range)
///
/// @group type-fonts
@@ -219,7 +219,7 @@ $fonts: () !default;
/// Map of font-data to be added at the given key.
/// @output An updated global `$fonts` variable,
/// with new maps merged in.
-@mixin add-font (
+@mixin add-font(
$key,
$map,
$force: false
diff --git a/sass/plugin/type/_fonts.scss b/sass/plugin/type/_fonts.scss
index 182cb56f..a54aa44c 100644
--- a/sass/plugin/type/_fonts.scss
+++ b/sass/plugin/type/_fonts.scss
@@ -13,8 +13,8 @@
/// Retrieve and normalize font data from the `$fonts` map
///
/// @since 1.0.0 -
-/// NEW: Use `font` to access a normalized map of font data
-/// for any key in your global `$fonts` map
+/// - NEW: Provided to access and normalize a map of font data
+/// for any key in your global `$fonts` map
///
/// @group type-fonts
/// @param {any} $font -
@@ -36,7 +36,7 @@
/// which simply prepends the global `$font-path` when appropriate.
///
/// @since type-4.0.0 -
-/// Supports Base64 data URI's, without prepending font-path.
+/// - BUGFIX: Supports Base64 data URI's, without prepending font-path
///
/// @group type-fonts
/// @example scss
@@ -65,7 +65,7 @@
/// with name and font-stack.
///
/// @since type-4.0.0 -
-/// Provides the correct name for fonts when an alias is given.
+/// - BUGFIX: Provides the correct name for fonts when an alias is given
///
/// @group type-fonts
/// @example scss
@@ -125,7 +125,7 @@
/// (variants without a path will not be imported).
///
/// @since type-4.0.0 -
-/// No longer accepts the `$formats` parameter
+/// - BREAKING: No longer accepts the `$formats` parameter
///
/// @group type-fonts
/// @example scss
@@ -168,10 +168,10 @@
/// and generate `@font-face` blocks for each individual font and variant.
///
/// @since 1.0.0 -
-/// No longer accepts the `$fonts` parameter,
-/// variant data should be normalized in advance
+/// - BREAKING: No longer accepts the `$fonts` parameter,
+/// variant data should be normalized in advance
/// @since type-4.0.0 -
-/// No longer accepts the `$formats` parameter
+/// - BREAKING: No longer accepts the `$formats` parameter
///
/// @group type-fonts
/// @example scss
diff --git a/sass/plugin/type/_helpers.scss b/sass/plugin/type/_helpers.scss
index 99f638ec..bb1d210e 100644
--- a/sass/plugin/type/_helpers.scss
+++ b/sass/plugin/type/_helpers.scss
@@ -71,7 +71,8 @@ $_a_FONT-FORMATS: (
/// [font-url]: fonts.html#function--font-url
///
/// @since type-4.0.0 -
-/// Added to format font-paths correctly, with file extension and suffix.
+/// - NEW: Added to format font-paths correctly,
+/// with file extension and suffix.
///
/// @access private
/// @group type-helpers
@@ -132,7 +133,7 @@ $_a_FONT-FORMATS: (
/// organizing them into the proper output order for browser-compatability.
///
/// @since type-4.0.0 -
-/// No longer accepts the `$format` parameter.
+/// - BREAKING: No longer accepts the `$format` parameter.
///
/// @access private
/// @group type-helpers
@@ -165,8 +166,8 @@ $_a_FONT-FORMATS: (
/// for one `@font-face` declaration block.
///
/// @since type-4.0.0 -
-/// Added to sort and compile src lists,
-/// with local() options and proper format order.
+/// - NEW: Added to sort and compile src lists,
+/// with local() options and proper format order.
///
/// @access private
/// @group type-helpers
@@ -213,10 +214,10 @@ $_a_FONT-FORMATS: (
/// and return a filtered font-map including only font-variants.
///
/// @since 0.1.0 -
-/// Supports `'bold italic'` weight/style syntax
-/// in addition to `('bold', 'italic')`
+/// - NEW: Supports `'bold italic'` weight/style syntax
+/// in addition to `('bold', 'italic')`
/// @since type-4.0.0 -
-/// Added to extract variant-data from a font-map
+/// - NEW: Added to extract variant-data from a font-map
///
/// @access private
/// @group type-helpers
diff --git a/sass/plugin/type/_normalize.scss b/sass/plugin/type/_normalize.scss
index ab861c45..ffdf89fb 100644
--- a/sass/plugin/type/_normalize.scss
+++ b/sass/plugin/type/_normalize.scss
@@ -123,11 +123,11 @@
/// Parse a list of font variants into a map of `style` and `weight` settings.
///
/// @since 0.1.0 -
-/// Supports `'bold italic'` weight/style syntax
-/// in addition to `('bold', 'italic')`
+/// - NEW: Supports `'bold italic'` weight/style syntax
+/// in addition to `('bold', 'italic')`
/// @since type-4.0.0 -
-/// - Name changed from `_parse-font-variant` for clarity.
-/// - Supports both string and number values for font-weight.
+/// - BREAKING: Name changed from `_parse-font-variant` for clarity.
+/// - NEW: Supports both string and number values for font-weight.
///
/// @access private
/// @group type-normalize
diff --git a/test/core/_parser.scss b/test/core/_parser.scss
index cd8ca893..511a1d82 100644
--- a/test/core/_parser.scss
+++ b/test/core/_parser.scss
@@ -15,14 +15,21 @@
@include it('Can start with a simple map key') {
@include assert-equal(
get-token($haystack, 'delay'),
- 0.5
+ 0.5s
);
}
@include it('Handles recursion with accoutrement-get') {
@include assert-equal(
get-token($haystack, 'key'),
- 3
+ 3s
+ );
+ }
+
+ @include it('Handles on-th-fly adjustments with $do') {
+ @include assert-equal(
+ get-token($haystack, 'key', ('octave': 2, 'minus': '#delay')),
+ 11.5s
);
}
}
@@ -339,6 +346,29 @@
}
+// Do Each [function]
+// ------------------
+@include describe('Do Each [function]') {
+ @include it('Handles each adjustment in a $do map') {
+ $map: (
+ 'root': 16px,
+ 'large': '#root',
+ );
+ $do: (
+ 'octave': 2,
+ 'plus': '#root' ('divide': 2),
+ );
+
+ @include assert-equal(
+ _a_do-each($map, 16px, $do),
+ 72px
+ );
+ }
+}
+
+
+// Do [function]
+// -------------
@include describe('Do [function]') {
@include it('Adjusts a number based on ratios') {
$source: (
diff --git a/test/core/_ratios.scss b/test/core/_ratios.scss
index 3ded8b01..ec78adeb 100644
--- a/test/core/_ratios.scss
+++ b/test/core/_ratios.scss
@@ -26,6 +26,13 @@
ratio('octave')
);
}
+
+ @include it('Accepts $do adjustments') {
+ @include assert-equal(
+ ratio('new', ('plus': 1)),
+ ratio('octave') + 1
+ );
+ }
}
diff --git a/test/core/_strings.scss b/test/core/_strings.scss
index 46be6a77..75683095 100644
--- a/test/core/_strings.scss
+++ b/test/core/_strings.scss
@@ -7,33 +7,35 @@
// --------------
@include describe('String Replace [function]') {
- @include it('Replacing a sub-string with another string') {
+ @include it('Replaces a sub-string with another string') {
@include assert-equal(
_a_str-replace('hello terrible world!', 'terrible', 'beautiful'),
'hello beautiful world!'
);
}
- @include it('Replacing a full string') {
+ @include it('Replaces a full string, with any type') {
@include assert-equal(
- _a_str-replace('hello', 'hello', 'world'),
- 'world'
+ _a_str-replace('hello', 'hello', 300ms),
+ 300ms
);
}
- @include it('Replacing a sub-string with nothing') {
+ @include it('Replaces a sub-string with nothing (false)') {
@include assert-equal(
_a_str-replace('hello world', 'hello ', false),
'world'
);
+ }
+ @include it('Replaces a sub-string with nothing (null)') {
@include assert-equal(
_a_str-replace('hello world', 'hello ', null),
'world'
);
}
- @include it('Replacing all instances of a sub-string') {
+ @include it('Replaces all instances of a sub-string') {
@include assert-equal(
_a_str-replace('hello world', 'o', '000', true),
'hell000 w000rld');
@@ -44,6 +46,14 @@
_a_str-replace('hello' 'world', 'o', '000', true),
'hell000' 'w000rld');
}
+
+ @include it('Forces $old and $new values to string type') {
+ @include assert-equal(
+ _a_str-replace('hello 0.5s world!', 0.5s, 250ms),
+ 'hello 250ms world!'
+ );
+ }
+
}
diff --git a/test/plugin/animate/_changes.scss b/test/plugin/animate/_changes.scss
index f5d21405..3fae1aa5 100644
--- a/test/plugin/animate/_changes.scss
+++ b/test/plugin/animate/_changes.scss
@@ -15,6 +15,13 @@
)
);
}
+
+ @include it('Applies on-the-fly adjustments') {
+ @include assert-equal(
+ change('slide', ('str-replace': 'transform' '-ms-transform')),
+ -ms-transform time('fast')
+ );
+ }
}
diff --git a/test/plugin/animate/_easing.scss b/test/plugin/animate/_easing.scss
index 5b3405b8..7900d442 100644
--- a/test/plugin/animate/_easing.scss
+++ b/test/plugin/animate/_easing.scss
@@ -26,6 +26,13 @@
cubic-bezier(0.455, 0.03, 0.515, 0.955)
);
}
+
+ @include it('Applies on-the-fly adjustments') {
+ @include assert-equal(
+ ease('sidebar-in', ('str-replace': 0.03 0.25)),
+ cubic-bezier(0.455, 0.25, 0.515, 0.955)
+ );
+ }
}
diff --git a/test/plugin/animate/_times.scss b/test/plugin/animate/_times.scss
index e4e61ee3..c17619fe 100644
--- a/test/plugin/animate/_times.scss
+++ b/test/plugin/animate/_times.scss
@@ -13,12 +13,19 @@
);
}
- @include it('Adjusted times') {
+ @include it('Get adjusted times') {
@include assert-equal(
time('plus-name'),
152ms
);
}
+
+ @include it('Makes on-the-fly adjustments') {
+ @include assert-equal(
+ time('plus-name', ('times': 2)),
+ 304ms
+ );
+ }
}
diff --git a/test/plugin/color/_api.scss b/test/plugin/color/_api.scss
index dfacef5b..71fa2f04 100644
--- a/test/plugin/color/_api.scss
+++ b/test/plugin/color/_api.scss
@@ -49,6 +49,13 @@
);
}
+ @include it('Handles on-the-fly adjustments argument') {
+ @include assert-equal(
+ color(#fcc, ('contrast': #999 #666 #333)),
+ #333
+ );
+ }
+
@include it('Works with a custom palette') {
$my-palette: (
'my-base': #393,
@@ -59,7 +66,7 @@
$expect: shade($expect, 10%);
@include assert-equal(
- color('my-adjustment', $my-palette),
+ color('my-adjustment', $palette: $my-palette),
$expect
);
}
diff --git a/test/plugin/layout/_queries.scss b/test/plugin/layout/_queries.scss
index bf5e5df7..ace9cf67 100644
--- a/test/plugin/layout/_queries.scss
+++ b/test/plugin/layout/_queries.scss
@@ -47,6 +47,13 @@
40em
);
}
+
+ @include it('Allows on-the-fly adjustments') {
+ @include assert-equal(
+ break('adjust', ('times': 2)),
+ 80em
+ );
+ }
}
diff --git a/test/plugin/scale/_size.scss b/test/plugin/scale/_size.scss
index a04969c6..62cda027 100644
--- a/test/plugin/scale/_size.scss
+++ b/test/plugin/scale/_size.scss
@@ -40,20 +40,27 @@
);
}
- @include it('Get unit-adjusted size') {
+ @include it('Get unit-adjusted size with string $do') {
@include assert-equal(
size(24px, 'rem'),
1.2rem
);
}
- @include it('Get unit-adjusted size with args') {
+ @include it('Get unit-adjusted size with list $do') {
@include assert-equal(
- size(24px, 'em', 10px),
+ size(24px, 'em' 10px),
2.4em
);
}
+ @include it('Run adjustments on the fly with map $do') {
+ @include assert-equal(
+ size(24px, ('to': 'em' 10px, 'times': 2)),
+ 4.8em
+ );
+ }
+
@include it('Adjusted size with multiple arguments') {
@include assert-equal(
size('medium-page'),