refactor: replace .forEach()
with for-of
(#39691)
* refactor: replace `.forEach()` with `for-of` * refactor docs/fiddles/features/web-hid/renderer.js
This commit is contained in:
parent
7858921a1f
commit
0b0707145b
32 changed files with 144 additions and 132 deletions
|
@ -136,9 +136,9 @@ describe('MenuItems', () => {
|
|||
|
||||
const groups = findRadioGroups(template);
|
||||
|
||||
groups.forEach(g => {
|
||||
for (const g of groups) {
|
||||
expect(findChecked(menu.items, g.begin!, g.end!)).to.deep.equal([g.begin]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it('should assign groupId automatically', () => {
|
||||
|
@ -146,7 +146,7 @@ describe('MenuItems', () => {
|
|||
|
||||
const usedGroupIds = new Set();
|
||||
const groups = findRadioGroups(template);
|
||||
groups.forEach(g => {
|
||||
for (const g of groups) {
|
||||
const groupId = (menu.items[g.begin!] as any).groupId;
|
||||
|
||||
// groupId should be previously unused
|
||||
|
@ -158,14 +158,14 @@ describe('MenuItems', () => {
|
|||
for (let i = g.begin!; i < g.end!; ++i) {
|
||||
expect((menu.items[i] as any).groupId).to.equal(groupId);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("setting 'checked' should flip other items' 'checked' property", () => {
|
||||
const menu = Menu.buildFromTemplate(template);
|
||||
|
||||
const groups = findRadioGroups(template);
|
||||
groups.forEach(g => {
|
||||
for (const g of groups) {
|
||||
expect(findChecked(menu.items, g.begin!, g.end!)).to.deep.equal([]);
|
||||
|
||||
menu.items[g.begin!].checked = true;
|
||||
|
@ -173,7 +173,7 @@ describe('MenuItems', () => {
|
|||
|
||||
menu.items[g.end! - 1].checked = true;
|
||||
expect(findChecked(menu.items, g.begin!, g.end!)).to.deep.equal([g.end! - 1]);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue