From: Geoff Kimball Date: Mon, 23 Nov 2015 22:16:17 +0000 (-0800) Subject: Rename hasvalue function to has-value, closes #7132 X-Git-Tag: v6.0.4~19^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96953b71119424c80e568fa30398c59142cb86ad;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Rename hasvalue function to has-value, closes #7132 --- diff --git a/docs/pages/sass-functions.md b/docs/pages/sass-functions.md index 298899a8c..e1d8f2de0 100644 --- a/docs/pages/sass-functions.md +++ b/docs/pages/sass-functions.md @@ -8,7 +8,7 @@ sass: --- ## Importing - + All of Foundation's Sass utilities are in the folder `scss/util`, and broken up into multiple files by category. You can import every utility file at once using this line of code: ```scss diff --git a/scss/components/_off-canvas.scss b/scss/components/_off-canvas.scss index 7288c7f7b..2dd05b9ac 100644 --- a/scss/components/_off-canvas.scss +++ b/scss/components/_off-canvas.scss @@ -68,7 +68,7 @@ $maincontent-shadow: 0 0 10px rgba($black, 0.5); backface-visibility: hidden; z-index: 1; - @if hasvalue($maincontent-shadow) { + @if has-value($maincontent-shadow) { box-shadow: $maincontent-shadow; } } diff --git a/scss/forms/_input-group.scss b/scss/forms/_input-group.scss index 73b68e4ac..4ba26c763 100644 --- a/scss/forms/_input-group.scss +++ b/scss/forms/_input-group.scss @@ -44,7 +44,7 @@ $input-prefix-padding: 1rem !default; color: $input-prefix-color; border: $input-prefix-border; - @if hasvalue($input-prefix-border) { + @if has-value($input-prefix-border) { &:first-child { border-#{$global-right}: 0; } diff --git a/scss/forms/_text.scss b/scss/forms/_text.scss index db475993c..8a2a1da9a 100644 --- a/scss/forms/_text.scss +++ b/scss/forms/_text.scss @@ -80,7 +80,7 @@ $input-radius: $global-radius !default; box-shadow: $input-shadow; border-radius: $input-radius; - @if hasvalue($input-transition) { + @if has-value($input-transition) { transition: $input-transition; } @@ -91,7 +91,7 @@ $input-radius: $global-radius !default; outline: none; box-shadow: $input-shadow-focus; - @if hasvalue($input-transition) { + @if has-value($input-transition) { transition: $input-transition; } } diff --git a/scss/util/_selector.scss b/scss/util/_selector.scss index ce0e61fbe..65b00b4fa 100644 --- a/scss/util/_selector.scss +++ b/scss/util/_selector.scss @@ -28,7 +28,7 @@ url color; - @if not hasvalue($types) { + @if not has-value($types) { $types: $all-types; } diff --git a/scss/util/_value.scss b/scss/util/_value.scss index 7d4b0f0d3..54c5443b8 100644 --- a/scss/util/_value.scss +++ b/scss/util/_value.scss @@ -6,12 +6,12 @@ /// @group functions //// -/// Determine if a value is not falsey, in CSS terms. Falsey values are `null`, `none`, `0` with any unit, or an empty list. +/// Determine if a value is not falsey, in CSS terms. Falsey values are `null`, `none`, `0` with any unit, or an empty list. **This function was originally named `hasvalue()`. The old name for the function will be removed in Foundation 6.1.** /// /// @param {Mixed} $val - Value to check. /// /// @returns {Boolean} `true` if `$val` is not falsey. -@function hasvalue($val) { +@function has-value($val) { @if $val == null or $val == none { @return false; } @@ -24,6 +24,12 @@ @return true; } +// Remove this in 6.1. +@function hasvalue($val) { + @warn 'The function hasvalue() was renamed to has-value(). The old function name will be removed in Foundation 6.1.'; + @return has-value($val); +} + /// Determine a top/right/bottom/right value on a padding, margin, etc. property, no matter how many values were passed in. Use this function if you need to know the specific side of a value, but don't know if the value is using a shorthand format. /// /// @param {List|Number} $val - Value to analyze. Should be a shorthand sizing property, e.g. "1em 2em 1em" diff --git a/test/sass/_value.scss b/test/sass/_value.scss index d7a7e6889..cd69a608e 100755 --- a/test/sass/_value.scss +++ b/test/sass/_value.scss @@ -2,10 +2,10 @@ @include describe('Has Value') { @include it('returns false if the value is not falsey') { - $boolean: hasvalue(true); - $number: hasvalue(1px); - $color: hasvalue(#000); - $list: hasvalue(1px solid black); + $boolean: has-value(true); + $number: has-value(1px); + $color: has-value(#000); + $list: has-value(1px solid black); @include should(expect($boolean), to(be(true))); @include should(expect($number), to(be(true))); @@ -13,10 +13,10 @@ @include should(expect($list), to(be(true))); } @include it('returns false if the value is falsey') { - $zero: hasvalue(0px); - $null: hasvalue(null); - $none: hasvalue(none); - $empty: hasvalue(()); + $zero: has-value(0px); + $null: has-value(null); + $none: has-value(none); + $empty: has-value(()); @include should(expect($zero), to(be(false))); @include should(expect($null), to(be(false)));