Skip to content

Commit

Permalink
Merge branch 'develop' into fix/api-configured-locale
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianallgeier committed Sep 28, 2019
2 parents f58ae57 + 30865e9 commit a2fd12d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
2 changes: 2 additions & 0 deletions panel/src/helpers/slug.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import "./regex.js";

export default (string, rules = [], allowed = "") => {

const separator = "-";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,44 @@
import { mount } from "@vue/test-utils";
import padZero from "@/helpers/padZero.js";
import pad from "@/helpers/pad.js";

describe("padZero Helper", () => {
describe("pad Helper", () => {

it("default padding", () => {
const result = padZero(1);
const result = pad(1);
expect(result).toBe("01");
});

it("default padding with unpadded number", () => {
const result = padZero(10);
const result = pad(10);
expect(result).toBe("10");
});

it("default padding with higher number", () => {
const result = padZero(120);
const result = pad(120);
expect(result).toBe("120");
});

it("default padding with zero", () => {
const result = padZero(0);
const result = pad(0);
expect(result).toBe("00");
});

it("custom padding", () => {
const result = padZero(1, 3);
const result = pad(1, 3);
expect(result).toBe("001");
});

it("custom padding with zero", () => {
const result = padZero(0, 3);
const result = pad(0, 3);
expect(result).toBe("000");
});

it("custom padding with unpadded number", () => {
const result = padZero(123, 3);
const result = pad(123, 3);
expect(result).toBe("123");
});

it("custom padding with higher number", () => {
const result = padZero(1234, 3);
const result = pad(1234, 3);
expect(result).toBe("1234");
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
import ratioPadding from "@/helpers/ratioPadding.js";
import ratio from "@/helpers/ratio.js";

describe("ratioPadding Helper", () => {
describe("ratio Helper", () => {

it("default ratio", () => {
const result = ratioPadding();
const result = ratio();
expect(result).toBe("66.66666666666667%");
});

it("16/9", () => {
const result = ratioPadding("16/9");
const result = ratio("16/9");
expect(result).toBe("56.25%");
});

it("invalid fraction 1", () => {
const result = ratioPadding("0/16");
const result = ratio("0/16");
expect(result).toBe("100%");
});

it("invalid fraction 2", () => {
const result = ratioPadding("16/0");
const result = ratio("16/0");
expect(result).toBe("100%");
});

it("invalid input 1", () => {
const result = ratioPadding(1);
const result = ratio(1);
expect(result).toBe("100%");
});

it("invalid input 2", () => {
const result = ratioPadding({});
const result = ratio({});
expect(result).toBe("100%");
});

Expand Down
3 changes: 1 addition & 2 deletions panel/tests/unit/Helpers/Slug.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils'
import slug from '@/helpers/slug.js'
import slug from "@/helpers/slug.js"

describe("Slug Helper", () => {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
import { ucfirst, lcfirst } from '@/helpers/StringCase.js'
import string from "@/helpers/string.js";

describe("String Case Helper", () => {

it("ucfirst", () => {
const result = ucfirst("hello");
const result = string.ucfirst("hello");
expect(result).toBe("Hello");
});

it("ucfirst with single-char word", () => {
const result = ucfirst("h");
const result = string.ucfirst("h");
expect(result).toBe("H");
});

it("ucfirst with wrong input", () => {
const result = ucfirst(0);
const result = string.ucfirst(0);
expect(result).toBe("0");
});

it("lcfirst", () => {
const result = lcfirst("Hello");
const result = string.lcfirst("Hello");
expect(result).toBe("hello");
});

it("lcfirst with single-char word", () => {
const result = lcfirst("H");
const result = string.lcfirst("H");
expect(result).toBe("h");
});

it("lcfirst with wrong input", () => {
const result = lcfirst(0);
const result = string.lcfirst(0);
expect(result).toBe("0");
});

Expand Down

0 comments on commit a2fd12d

Please sign in to comment.