blob: fb3a545c2e23c2195a41167ee829fa6340b4f20f (
plain) (
blame)
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
|
// sass-lint:disable class-name-format force-element-nesting force-pseudo-nesting mixins-before-declarations
@use 'true' as *;
@use '../../src/bem';
//
// Included test cases:
// - /// 1 /// - without namespace
// - /// 2 /// - with namespace
// - /// 3 /// - nested
// - /// 4 /// - within selector
//
@include it('block') {
@include assert('without namespace') { /// 1 ///
@include output(false) {
@include bem.block('something') {
font-size: 1em;
}
}
@include expect(false) {
.something {
font-size: 1em;
}
}
}
@each $ns in map-keys(bem.$namespaces) {
@include assert('with namespace "#{$ns}"') { /// 2 ///
@include output(false) {
@include bem.block('something', $ns) {
font-size: 1em;
}
}
@include expect(false) {
@if $ns != 'theme' {
.#{map-get(bem.$namespaces, $ns)}-something {
font-size: 1em;
}
} @else {
.t-something,
[class*=' t-'] .t-something,
[class^='t-'] .t-something {
font-size: 1em;
}
}
}
}
}
@include assert('nested') { /// 3 ///
@include output(false) {
@include bem.theme('theme') {
@include bem.theme('subtheme') {
@include bem.block('something') {
font-size: 2em;
}
}
}
}
@include expect(false) {
.t-theme .t-subtheme .something,
[class*=' t-'] .t-theme .t-subtheme .something,
[class^='t-'] .t-theme .t-subtheme .something {
font-size: 2em;
}
}
}
@include assert('within selector') { /// 4 ///
@include output(false) {
.sel {
@include bem.block('something') {
font-size: 2em;
}
}
}
@include expect(false) {
.sel .something {
font-size: 2em;
}
}
}
}
|