// 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, single // - /// 2 /// - with namespace, single // - /// 3 /// - without namespace, multiple // - /// 4 /// - with namespace, multiple // @include it('composed-of') { @include assert('without namespace, single') { /// 1 /// @include output(false) { @include bem.block('something') { font-size: 1em; } @include bem.block('another') { @include bem.composed-of('something'); font-size: 2em; } } @include expect(false) { .something { font-size: 1em; } .another { font-size: 2em; } } } @each $ns in map-keys(bem.$namespaces) { @include assert('with namespace "#{$ns}", single') { /// 2 /// @include output(false) { @include bem.block('something', $ns) { font-size: 1em; } @include bem.block('another') { @include bem.composed-of('something' $ns); font-size: 2em; } } @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; } } .another { font-size: 2em; } } } } @include assert('without namespace, multiple') { /// 3 /// @include output(false) { @include bem.block('something') { font-size: 1em; } @include bem.block('somethingElse') { font-size: 1em; } @include bem.block('another') { @include bem.composed-of('something', 'somethingElse'); font-size: 2em; } } @include expect(false) { .something { font-size: 1em; } .somethingElse { font-size: 1em; } .another { font-size: 2em; } } } @each $ns in map-keys(bem.$namespaces) { @include assert('with namespace "#{$ns}", multiple') { /// 4 /// @include output(false) { @include bem.block('something', $ns) { font-size: 1em; } @include bem.block('somethingElse', $ns) { font-size: 1em; } @include bem.block('another') { @include bem.composed-of('something' $ns, 'somethingElse' $ns); font-size: 2em; } } @include expect(false) { @if $ns != 'theme' { .#{map-get(bem.$namespaces, $ns)}-something { font-size: 1em; } .#{map-get(bem.$namespaces, $ns)}-somethingElse { font-size: 1em; } } @else { .t-something, [class*=' t-'] .t-something, [class^='t-'] .t-something { font-size: 1em; } .t-somethingElse, [class*=' t-'] .t-somethingElse, [class^='t-'] .t-somethingElse { font-size: 1em; } } .another { font-size: 2em; } } } } }