1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
@import "../../functions";
@import "../../variables";
@import "../../mixins";
// Store original value
$original-enable-shadows: $enable-shadows;
// Enable shadows for all tests
$enable-shadows: true !global;
@include describe("box-shadow mixin") {
@include it("handles single none value") {
@include assert() {
@include output() {
.test {
@include box-shadow(none);
}
}
@include expect() {
.test {
box-shadow: none;
}
}
}
}
@include it("handles multiple none values by consolidating them") {
@include assert() {
@include output() {
.test {
@include box-shadow(none, none, none);
}
}
@include expect() {
.test {
box-shadow: none;
}
}
}
}
@include it("handles other single-value keywords (initial, inherit, unset)") {
@include assert() {
@include output() {
.test-initial {
@include box-shadow(initial);
}
.test-inherit {
@include box-shadow(inherit);
}
.test-unset {
@include box-shadow(unset);
}
}
@include expect() {
.test-initial {
box-shadow: initial;
}
.test-inherit {
box-shadow: inherit;
}
.test-unset {
box-shadow: unset;
}
}
}
}
@include it("handles multiple single-value keywords by using the last one") {
@include assert() {
@include output() {
.test {
@include box-shadow(initial, inherit, unset);
}
}
@include expect() {
.test {
box-shadow: unset;
}
}
}
}
@include it("handles regular box-shadow values") {
@include assert() {
@include output() {
.test {
@include box-shadow(0 0 10px rgba(0, 0, 0, .5));
}
}
@include expect() {
.test {
box-shadow: 0 0 10px rgba(0, 0, 0, .5);
}
}
}
}
@include it("handles multiple regular box-shadow values") {
@include assert() {
@include output() {
.test {
@include box-shadow(0 0 10px rgba(0, 0, 0, .5), 0 0 20px rgba(0, 0, 0, .3));
}
}
@include expect() {
.test {
box-shadow: 0 0 10px rgba(0, 0, 0, .5), 0 0 20px rgba(0, 0, 0, .3);
}
}
}
}
@include it("handles null values by ignoring them") {
@include assert() {
@include output() {
.test {
@include box-shadow(null, 0 0 10px rgba(0, 0, 0, .5), null);
}
}
@include expect() {
.test {
box-shadow: 0 0 10px rgba(0, 0, 0, .5);
}
}
}
}
@include it("handles mixed values with keywords and regular shadows") {
@include assert() {
@include output() {
.test {
@include box-shadow(none, 0 0 10px rgba(0, 0, 0, .5));
}
}
@include expect() {
.test {
box-shadow: none;
}
}
}
}
@include it("handles empty input") {
@include assert() {
@include output() {
.test {
@include box-shadow();
}
}
@include expect() {
.test { // stylelint-disable-line block-no-empty
}
}
}
}
@include it("respects $enable-shadows variable") {
$enable-shadows: false !global;
@include assert() {
@include output() {
.test {
@include box-shadow(0 0 10px rgba(0, 0, 0, .5));
}
}
@include expect() {
.test { // stylelint-disable-line block-no-empty
}
}
}
$enable-shadows: true !global;
}
}
// Restore original value
$enable-shadows: $original-enable-shadows !global;
|