Skip to content
This repository was archived by the owner on Aug 7, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions packages/oui-action-menu/src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ describe("ouiActionMenu", () => {
const element = TestUtils.compileTemplate(
`<oui-action-menu>
<oui-action-menu-item on-click="$ctrl.clickHandler()">Action 1</oui-action-menu-item>
</oui-action-menu>`,
{
</oui-action-menu>`, {
clickHandler: clickSpy
}
);
});

const buttonElement = element[0].querySelector("button");
expect(buttonElement).toBeTruthy();
Expand Down
12 changes: 6 additions & 6 deletions packages/oui-checkbox/src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ describe("ouiCheckbox", () => {
const element = TestUtils.compileTemplate(`
<oui-checkbox required="$ctrl.isRequired"></oui-checkbox>
`, {
isRequired: true
});
isRequired: true
});

const checkboxElement = getCheckboxInputElement(element);
expect(angular.element(checkboxElement).prop("required")).toBe(true);
Expand All @@ -230,8 +230,8 @@ describe("ouiCheckbox", () => {
const element = TestUtils.compileTemplate(`
<oui-checkbox required="$ctrl.isRequired"></oui-checkbox>
`, {
isRequired: false
});
isRequired: false
});

const checkboxElement = getCheckboxInputElement(element);
expect(angular.element(checkboxElement).prop("required")).toBe(false);
Expand All @@ -242,8 +242,8 @@ describe("ouiCheckbox", () => {
<oui-checkbox name="checkbox" required="$ctrl.isRequired"></oui-checkbox>
</form>
`, {
isRequired: true
});
isRequired: true
});

const form = element.scope().form;
const checkboxElement = getCheckboxInputElement(element);
Expand Down
3 changes: 2 additions & 1 deletion packages/oui-criteria-adder/src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ describe("ouiCriteriaAdder", () => {
const submitButton = component[0].querySelectorAll("[type=submit]");
const dropdown = component.find("oui-dropdown");
const fields = component.find("oui-field");
const expectedLength = 3;

expect(form.length).toBe(1);
expect(triggerButton.length).toBe(1);
expect(submitButton.length).toBe(1);
expect(angular.element(triggerButton).attr("oui-dropdown-trigger")).toBeDefined();
expect(dropdown.length).toBe(1);
expect(fields.length).toBe(3);
expect(fields.length).toBe(expectedLength);
});

it("should have an attribute id and name on the form and every inputs/selectors, and removed on the root component", () => {
Expand Down
9 changes: 6 additions & 3 deletions packages/oui-criteria-container/src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ describe("ouiCriteriaContainer", () => {
it("should delete a criteria", () => {
controller.criteria.push(criterion);
controller.criteria.push(criterion2);
expect(controller.criteria.length).toEqual(2);
const expectedLength = 2;
expect(controller.criteria.length).toEqual(expectedLength);

controller.remove(criterion);
expect(controller.criteria.length).toEqual(1);
Expand All @@ -87,13 +88,15 @@ describe("ouiCriteriaContainer", () => {
expect(controller.criteria.length).toEqual(0);

controller.set(criteria);
expect(controller.criteria.length).toEqual(2);
const expectedLength = 2;
expect(controller.criteria.length).toEqual(expectedLength);
});

it("should delete all criteria", () => {
controller.criteria.push(criterion);
controller.criteria.push(criterion2);
expect(controller.criteria.length).toEqual(2);
const expectedLength = 2;
expect(controller.criteria.length).toEqual(expectedLength);

controller.clear();
expect(controller.criteria.length).toEqual(0);
Expand Down
12 changes: 8 additions & 4 deletions packages/oui-datagrid/src/filter/filter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ describe("Filter", () => {
it("should apply 1 filter", () => {
filter = new Filter([textSearchCriterion], columns);
const filtered = filter.applyFilter(fakeData);
expect(filtered.length).toBe(2);
const expectedLength = 2;
expect(filtered.length).toBe(expectedLength);
});
});

Expand All @@ -92,7 +93,8 @@ describe("Filter", () => {
it("should find text in object", () => {
filter = new Filter([textSearchCriterion], columns);
const filtered = filter.applyCriteria(fakeData, textSearchCriterion);
expect(filtered.length).toBe(2);
const expectedLength = 2;
expect(filtered.length).toBe(expectedLength);
});
});

Expand All @@ -106,7 +108,8 @@ describe("Filter", () => {
operator: "contains",
value: "aaron"
});
expect(filtered.length).toBe(2);
const expectedLength = 2;
expect(filtered.length).toBe(expectedLength);
});

it("should filter (negated)", () => {
Expand All @@ -117,7 +120,8 @@ describe("Filter", () => {
operator: "containsNot",
value: "aaron"
});
expect(filtered.length).toBe(fakeData.length - 2);
const expectedLength = 2;
expect(filtered.length).toBe(fakeData.length - expectedLength);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe("ouiDatagridParameters", () => {

it("should display a disabled checkbox column when customization is prevented", () => {
const columnsElements = getColumns(element);
const disabledColumn = getCheckbox(columnsElements, 3);
const disabledColumn = getCheckbox(columnsElements, 3); // eslint-disable-line no-magic-numbers
expect(disabledColumn.prop("disabled")).toBe(true);
});
});
Expand All @@ -91,7 +91,7 @@ describe("ouiDatagridParameters", () => {
const columnsElements = getColumns(element);
const $checkbox1 = getCheckbox(columnsElements, 0);
const $checkbox2 = getCheckbox(columnsElements, 1);
const $checkbox3 = getCheckbox(columnsElements, 2);
const $checkbox3 = getCheckbox(columnsElements, 2); // eslint-disable-line no-magic-numbers
const expected = angular.copy(columns);
expected[0].hidden = true;

Expand Down
3 changes: 2 additions & 1 deletion packages/oui-dropdown/src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ describe("ouiDropdown", () => {
</oui-dropdown>
`);
const links = element.find("oui-dropdown-item").find("a");
const expectedLength = 2;

expect(links.length).toBe(2);
expect(links.length).toBe(expectedLength);
expect(links.hasClass("oui-dropdown-option")).toBeTruthy();
});

Expand Down
3 changes: 2 additions & 1 deletion packages/oui-field/src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ describe("ouiField", () => {
describe("with radio buttons", () => {
it("should detect all the radio buttons", () => {
const name = "protocol";
const expectedLength = 3;

const element = TestUtils.compileTemplate(`
<oui-field>
Expand Down Expand Up @@ -454,7 +455,7 @@ describe("ouiField", () => {
const controller = element.controller("ouiField");

// There is 3 HTML elements with the same name
expect(controller.controls[name].length).toEqual(3);
expect(controller.controls[name].length).toEqual(expectedLength);
});
});

Expand Down
8 changes: 4 additions & 4 deletions packages/oui-form-actions/src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ describe("ouiFormActions", () => {
on-submit="$ctrl.onSubmitTest()"
on-cancel="$ctrl.onCancelTest()">
</oui-form-actions>`, {
onSubmitTest: jasmine.createSpy("onSubmit")
});
onSubmitTest: jasmine.createSpy("onSubmit")
});
component.find("button").eq(0).triggerHandler("click");

expect(component.scope().$ctrl.onSubmitTest).toHaveBeenCalled();
Expand All @@ -127,8 +127,8 @@ describe("ouiFormActions", () => {
on-submit="$ctrl.onSubmitTest()"
on-cancel="$ctrl.onCancelTest()">
</oui-form-actions>`, {
onCancelTest: jasmine.createSpy("onCancel")
});
onCancelTest: jasmine.createSpy("onCancel")
});
component.find("button").eq(1).triggerHandler("click");

expect(component.scope().$ctrl.onCancelTest).toHaveBeenCalled();
Expand Down
74 changes: 37 additions & 37 deletions packages/oui-navbar/src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ describe("ouiNavbar", () => {
aside-links="$ctrl.asideLinks"
toggler-links="$ctrl.togglerLinks">
</oui-navbar>`, {
brand: mockData.brand,
activeLink: mockData.mainLinks[0].name,
mainLinks: mockData.mainLinks,
asideLinks: mockData.asideLinks,
togglerLinks: mockData.togglerLinks
});
brand: mockData.brand,
activeLink: mockData.mainLinks[0].name,
mainLinks: mockData.mainLinks,
asideLinks: mockData.asideLinks,
togglerLinks: mockData.togglerLinks
});
const controller = component.controller("ouiNavbar");

$timeout.flush();
Expand Down Expand Up @@ -238,8 +238,8 @@ describe("ouiNavbar", () => {
icon-class="{{$ctrl.brand.iconClass}}"></oui-navbar-brand>
<oui-navbar-main>
</oui-navbar>`, {
brand: data
});
brand: data
});
controller = component.find("oui-navbar-brand").controller("ouiNavbarBrand");

$timeout.flush();
Expand Down Expand Up @@ -287,13 +287,13 @@ describe("ouiNavbar", () => {
</oui-navbar-dropdown>
<oui-navbar-aside>
</oui-navbar>`, {
name: "foo",
title: "bar",
label: "lorem",
badge: 5,
icon: "oui-icon oui-icon-help_circle",
text: "Lorem ipsum"
});
name: "foo",
title: "bar",
label: "lorem",
badge: 5,
icon: "oui-icon oui-icon-help_circle",
text: "Lorem ipsum"
});

$timeout.flush();
});
Expand Down Expand Up @@ -332,13 +332,13 @@ describe("ouiNavbar", () => {
</oui-navbar-dropdown>
<oui-navbar-aside>
</oui-navbar>`, {
name: "foo",
title: "bar",
label: "lorem",
badge: 5,
icon: "oui-icon oui-icon-help_circle",
text: "Lorem ipsum"
});
name: "foo",
title: "bar",
label: "lorem",
badge: 5,
icon: "oui-icon oui-icon-help_circle",
text: "Lorem ipsum"
});
const dropdownMenu = component.find("oui-navbar-dropdown-menu");

$timeout.flush();
Expand Down Expand Up @@ -367,11 +367,11 @@ describe("ouiNavbar", () => {
</oui-navbar-dropdown>
<oui-navbar-aside>
</oui-navbar>`, {
name: data.name,
title: data.title,
headerTitle: data.headerTitle,
subLinks: data.subLinks
});
name: data.name,
title: data.title,
headerTitle: data.headerTitle,
subLinks: data.subLinks
});

$timeout.flush();

Expand Down Expand Up @@ -403,11 +403,11 @@ describe("ouiNavbar", () => {
</oui-navbar-dropdown>
<oui-navbar-aside>
</oui-navbar>`, {
name: data.name,
title: data.title,
headerTitle: data.headerTitle,
subLinks: data.subLinks
});
name: data.name,
title: data.title,
headerTitle: data.headerTitle,
subLinks: data.subLinks
});

$timeout.flush();

Expand All @@ -430,11 +430,11 @@ describe("ouiNavbar", () => {
</oui-navbar-dropdown>
<oui-navbar-aside>
</oui-navbar>`, {
name: data.name,
title: data.title,
headerTitle: data.headerTitle,
subLinks: data.subLinks
});
name: data.name,
title: data.title,
headerTitle: data.headerTitle,
subLinks: data.subLinks
});

$timeout.flush();

Expand Down
Loading