This commit is contained in:
@@ -1,6 +1,23 @@
|
||||
import '../../../fomantic/build/fomantic.js';
|
||||
import {createElementFromHTML} from '../../utils/dom.ts';
|
||||
import {hideScopedEmptyDividers} from './dropdown.ts';
|
||||
|
||||
test('dropdown-item-literal-text', () => {
|
||||
// a "choice" workflow_dispatch input can offer the string "false" as an option.
|
||||
// jQuery `.data()` would coerce `data-text="false"` to the boolean `false`, which then renders as empty text.
|
||||
const $dropdown = $(`<select class="ui dropdown">
|
||||
<option value="1">1</option>
|
||||
<option value="0">0</option>
|
||||
<option value="true">true</option>
|
||||
<option value="false">false</option>
|
||||
</select>`).dropdown();
|
||||
for (const value of ['1', '0', 'true', 'false']) {
|
||||
$dropdown.dropdown('set selected', value);
|
||||
expect($dropdown.dropdown('get text')).toEqual(value);
|
||||
expect($dropdown.dropdown('get value')).toEqual(value);
|
||||
}
|
||||
});
|
||||
|
||||
test('hideScopedEmptyDividers-simple', () => {
|
||||
const container = createElementFromHTML(`<div>
|
||||
<div class="divider"></div>
|
||||
@@ -13,13 +30,13 @@ test('hideScopedEmptyDividers-simple', () => {
|
||||
</div>`);
|
||||
hideScopedEmptyDividers(container);
|
||||
expect(container.innerHTML).toEqual(`
|
||||
<div class="divider hidden transition"></div>
|
||||
<div class="divider hidden"></div>
|
||||
<div class="item">a</div>
|
||||
<div class="divider hidden transition"></div>
|
||||
<div class="divider hidden transition"></div>
|
||||
<div class="divider hidden"></div>
|
||||
<div class="divider hidden"></div>
|
||||
<div class="divider"></div>
|
||||
<div class="item">b</div>
|
||||
<div class="divider hidden transition"></div>
|
||||
<div class="divider hidden"></div>
|
||||
`);
|
||||
});
|
||||
|
||||
@@ -35,7 +52,7 @@ test('hideScopedEmptyDividers-items-all-filtered', () => {
|
||||
hideScopedEmptyDividers(container);
|
||||
expect(container.innerHTML).toEqual(`
|
||||
<div class="any"></div>
|
||||
<div class="divider hidden transition"></div>
|
||||
<div class="divider hidden"></div>
|
||||
<div class="item filtered">a</div>
|
||||
<div class="item filtered">b</div>
|
||||
<div class="divider"></div>
|
||||
@@ -52,7 +69,7 @@ test('hideScopedEmptyDividers-hide-last', () => {
|
||||
hideScopedEmptyDividers(container);
|
||||
expect(container.innerHTML).toEqual(`
|
||||
<div class="item">a</div>
|
||||
<div class="divider hidden transition" data-scope="b"></div>
|
||||
<div class="divider hidden" data-scope="b"></div>
|
||||
<div class="item tw-hidden" data-scope="b">b</div>
|
||||
`);
|
||||
});
|
||||
@@ -68,9 +85,9 @@ test('hideScopedEmptyDividers-scoped-items', () => {
|
||||
hideScopedEmptyDividers(container);
|
||||
expect(container.innerHTML).toEqual(`
|
||||
<div class="item" data-scope="">a</div>
|
||||
<div class="divider hidden transition" data-scope="b"></div>
|
||||
<div class="divider hidden" data-scope="b"></div>
|
||||
<div class="item tw-hidden" data-scope="b">b</div>
|
||||
<div class="divider hidden transition" data-scope=""></div>
|
||||
<div class="divider hidden" data-scope=""></div>
|
||||
<div class="item" data-scope="">c</div>
|
||||
`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user