Resolve Lint errors in CommandBarUtil.test.tsx (#529)
This commit is contained in:
parent
641dae30a1
commit
2e7c7440d3
|
@ -315,10 +315,7 @@ src/Explorer/Graph/GraphExplorerComponent/QueryContainerComponent.tsx
|
||||||
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNeighborsComponent.tsx
|
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNeighborsComponent.tsx
|
||||||
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.test.tsx
|
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.test.tsx
|
||||||
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.tsx
|
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.tsx
|
||||||
src/Explorer/Menus/CommandBar/CommandBarComponentAdapter.tsx
|
|
||||||
src/Explorer/Menus/CommandBar/CommandBarUtil.test.tsx
|
|
||||||
src/Explorer/Menus/CommandBar/CommandBarUtil.tsx
|
src/Explorer/Menus/CommandBar/CommandBarUtil.tsx
|
||||||
src/Explorer/Menus/CommandBar/MemoryTrackerComponent.tsx
|
|
||||||
src/Explorer/Menus/NavBar/ControlBarComponent.tsx
|
src/Explorer/Menus/NavBar/ControlBarComponent.tsx
|
||||||
src/Explorer/Menus/NavBar/ControlBarComponentAdapter.tsx
|
src/Explorer/Menus/NavBar/ControlBarComponentAdapter.tsx
|
||||||
src/Explorer/Menus/NavBar/MeControlComponent.test.tsx
|
src/Explorer/Menus/NavBar/MeControlComponent.test.tsx
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import * as CommandBarUtil from "./CommandBarUtil";
|
import * as CommandBarUtil from "./CommandBarUtil";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
|
||||||
import { ICommandBarItemProps } from "office-ui-fabric-react/lib/CommandBar";
|
import { ICommandBarItemProps } from "office-ui-fabric-react/lib/CommandBar";
|
||||||
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
||||||
|
|
||||||
|
@ -26,7 +25,7 @@ describe("CommandBarUtil tests", () => {
|
||||||
const converteds = CommandBarUtil.convertButton([btn], backgroundColor);
|
const converteds = CommandBarUtil.convertButton([btn], backgroundColor);
|
||||||
expect(converteds.length).toBe(1);
|
expect(converteds.length).toBe(1);
|
||||||
const converted = converteds[0];
|
const converted = converteds[0];
|
||||||
expect(!converted.split);
|
expect(converted.split).toBe(undefined);
|
||||||
expect(converted.iconProps.imageProps.src).toEqual(btn.iconSrc);
|
expect(converted.iconProps.imageProps.src).toEqual(btn.iconSrc);
|
||||||
expect(converted.iconProps.imageProps.alt).toEqual(btn.iconAlt);
|
expect(converted.iconProps.imageProps.alt).toEqual(btn.iconAlt);
|
||||||
expect(converted.text).toEqual(btn.commandButtonLabel);
|
expect(converted.text).toEqual(btn.commandButtonLabel);
|
||||||
|
@ -50,7 +49,7 @@ describe("CommandBarUtil tests", () => {
|
||||||
const converteds = CommandBarUtil.convertButton([btn], "backgroundColor");
|
const converteds = CommandBarUtil.convertButton([btn], "backgroundColor");
|
||||||
expect(converteds.length).toBe(1);
|
expect(converteds.length).toBe(1);
|
||||||
const converted = converteds[0];
|
const converted = converteds[0];
|
||||||
expect(converted.split);
|
expect(converted.split).toBe(true);
|
||||||
expect(converted.subMenuProps.items.length).toBe(btn.children.length);
|
expect(converted.subMenuProps.items.length).toBe(btn.children.length);
|
||||||
for (let i = 0; i < converted.subMenuProps.items.length; i++) {
|
for (let i = 0; i < converted.subMenuProps.items.length; i++) {
|
||||||
expect(converted.subMenuProps.items[i].text).toEqual(btn.children[i].commandButtonLabel);
|
expect(converted.subMenuProps.items[i].text).toEqual(btn.children[i].commandButtonLabel);
|
||||||
|
@ -64,7 +63,6 @@ describe("CommandBarUtil tests", () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const converteds = CommandBarUtil.convertButton(btns, "backgroundColor");
|
const converteds = CommandBarUtil.convertButton(btns, "backgroundColor");
|
||||||
const keys = converteds.map((btn: ICommandBarItemProps) => btn.key);
|
|
||||||
const uniqueKeys = converteds
|
const uniqueKeys = converteds
|
||||||
.map((btn: ICommandBarItemProps) => btn.key)
|
.map((btn: ICommandBarItemProps) => btn.key)
|
||||||
.filter((value: string, index: number, self: string[]) => self.indexOf(value) === index);
|
.filter((value: string, index: number, self: string[]) => self.indexOf(value) === index);
|
||||||
|
@ -75,7 +73,7 @@ describe("CommandBarUtil tests", () => {
|
||||||
const btn = createButton();
|
const btn = createButton();
|
||||||
const backgroundColor = "backgroundColor";
|
const backgroundColor = "backgroundColor";
|
||||||
|
|
||||||
btn.commandButtonLabel = null;
|
btn.commandButtonLabel = undefined;
|
||||||
let converted = CommandBarUtil.convertButton([btn], backgroundColor)[0];
|
let converted = CommandBarUtil.convertButton([btn], backgroundColor)[0];
|
||||||
expect(converted.text).toEqual(btn.tooltipText);
|
expect(converted.text).toEqual(btn.tooltipText);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue