aboutsummaryrefslogtreecommitdiffstats
path: root/test/bem/_suffix.scss
blob: cfec25b88032767249d6ae0e9fd857bbf3bf4e73 (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
89
90
91
92
93
94
95
96
97
// 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 /// - block suffix
//  - /// 2 /// - element suffix
//  - /// 3 /// - modifier suffix
//  - /// 4 /// - multiple element suffix
//

@include it('suffix') {
	@include assert('block suffix') { /// 1 ///
		@include output {
			@include bem.block('something') {
				@include bem.suffix('sm') {
					font-size: 1.5em;
				}
			}
		}

		@include expect {
			.something\@sm {
				font-size: 1.5em;
			}
		}
	}

	@include assert('element suffix') { /// 2 ///
		@include output {
			@include bem.block('something') {
				@include bem.elem('child') {
					@include bem.suffix('sm') {
						font-size: 2.5em;
					}
				}
			}
		}

		@include expect {
			.something__child\@sm {
				font-size: 2.5em;
			}
		}
	}

	@include assert('modifier suffix') { /// 3 ///
		@include output {
			@include bem.block('something') {
				@include bem.modifier('mod1') {
					@include bem.suffix('sm') {
						font-size: 1.75em;
					}
				}

				@include bem.elem('child') {
					@include bem.modifier('mod2') {
						@include bem.suffix('sm') {
							font-size: 2.75em;
						}
					}
				}
			}
		}

		@include expect {
			.something--mod1\@sm {
				font-size: 1.75em;
			}

			.something__child--mod2\@sm {
				font-size: 2.75em;
			}
		}
	}

	@include assert('multiple element suffix') { /// 4 ///
		@include output {
			@include bem.block('something') {
				@include bem.elem('child1', 'child2') {
					@include bem.suffix('sm') {
						font-size: 2.5em;
					}
				}
			}
		}

		@include expect {
			.something__child1\@sm,
			.something__child2\@sm {
				font-size: 2.5em;
			}
		}
	}
}