-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from CanopyTax/react-18
update to react 18 and things
- Loading branch information
Showing
22 changed files
with
7,647 additions
and
5,169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
nodeLinker: node-modules | ||
|
||
yarnPath: .yarn/releases/yarn-3.6.4.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
ignore: ["**/*.test.js"], | ||
presets: ["@babel/preset-env", "@babel/preset-react"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,95 @@ | ||
import { always, maybe, toggle } from "./classname-helpers.js"; | ||
|
||
describe("Classname helpers", function() { | ||
it("should always return through a chain", function() { | ||
describe("Classname helpers", function () { | ||
it("should always return through a chain", function () { | ||
expect(always("krimp").toString()).toBe("krimp"); | ||
expect( | ||
always("krimp") | ||
.always("klaptrap") | ||
.always("klank") | ||
.toString() | ||
).toBe("krimp klaptrap klank"); | ||
expect(always("krimp").always("klaptrap").always("klank").toString()).toBe( | ||
"krimp klaptrap klank", | ||
); | ||
}); | ||
|
||
it("should maybe return through a chain", function() { | ||
it("should maybe return through a chain", function () { | ||
expect(maybe("krimp", false).toString()).toBe(""); | ||
expect(maybe("krimp", true).toString()).toBe("krimp"); | ||
expect( | ||
maybe("krimp", true) | ||
.maybe("klaptrap", false) | ||
.maybe("klank", true) | ||
.toString() | ||
.toString(), | ||
).toBe("krimp klank"); | ||
}); | ||
|
||
it("should toggle return through a chain", function() { | ||
it("should toggle return through a chain", function () { | ||
expect(toggle("ksmash", "kair").toString()).toBe("kair"); | ||
expect(toggle("krimp", "kramp", false).toString()).toBe("kramp"); | ||
expect(toggle("krimp", "kramp", true).toString()).toBe("krimp"); | ||
expect( | ||
toggle("krimp", "kramp", true) | ||
.toggle("klaptrap", "klapsnap", false) | ||
.toggle("klank", "klink", true) | ||
.toString() | ||
.toString(), | ||
).toBe("krimp klapsnap klank"); | ||
}); | ||
|
||
it("should maybe and always return through a chain", function() { | ||
it("should maybe and always return through a chain", function () { | ||
expect( | ||
maybe("krimp", true) | ||
.always("kannon") | ||
.maybe("klaptrap", false) | ||
.maybe("klank", true) | ||
.always("kloak") | ||
.toString() | ||
.toString(), | ||
).toBe("krimp kannon klank kloak"); | ||
}); | ||
|
||
it("should maybe and toggle return through a chain", function() { | ||
it("should maybe and toggle return through a chain", function () { | ||
expect( | ||
maybe("krimp", true) | ||
.toggle("kannon", "keenon", false) | ||
.maybe("klaptrap", false) | ||
.maybe("klank", true) | ||
.toggle("kloak", "koat", true) | ||
.toString() | ||
.toString(), | ||
).toBe("krimp keenon klank kloak"); | ||
}); | ||
|
||
it("should always and toggle return through a chain", function() { | ||
it("should always and toggle return through a chain", function () { | ||
expect( | ||
always("krimp") | ||
.toggle("kannon", "keenon", false) | ||
.always("klaptrap") | ||
.always("klank") | ||
.toggle("kloak", "koat", true) | ||
.toString() | ||
.toString(), | ||
).toBe("krimp keenon klaptrap klank kloak"); | ||
}); | ||
|
||
it("should always maybe and toggle return through a chain", function() { | ||
it("should always maybe and toggle return through a chain", function () { | ||
expect( | ||
always("krimp") | ||
.toggle("kannon", "keenon", false) | ||
.always("klaptrap") | ||
.maybe("klank", true) | ||
.toggle("kloak", "koat", true) | ||
.maybe("klump", false) | ||
.toString() | ||
.toString(), | ||
).toBe("krimp keenon klaptrap klank kloak"); | ||
}); | ||
|
||
it("should throw when a non string is passed", function() { | ||
it("should throw when a non string is passed", function () { | ||
expect(() => maybe(2)).toThrow(); | ||
expect(() => always('dk').maybe(2)).toThrow(); | ||
expect(() => toggle('yoshi', true)).toThrow(); | ||
expect(() => always('sup').maybe('yo', true).toggle('blop', false)).toThrow(); | ||
expect(() => always("dk").maybe(2)).toThrow(); | ||
expect(() => toggle("yoshi", true)).toThrow(); | ||
expect(() => | ||
always("sup").maybe("yo", true).toggle("blop", false), | ||
).toThrow(); | ||
}); | ||
|
||
it("should accept a boxed string as an argument", () => { | ||
const boxedKremlingString = always('thing') | ||
const boxedKremlingString2 = always('thing2') | ||
always(boxedKremlingString) | ||
maybe(boxedKremlingString, true) | ||
toggle(boxedKremlingString, boxedKremlingString2, true) | ||
const boxedKremlingString = always("thing"); | ||
const boxedKremlingString2 = always("thing2"); | ||
always(boxedKremlingString); | ||
maybe(boxedKremlingString, true); | ||
toggle(boxedKremlingString, boxedKremlingString2, true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
export const k = (strings, ...args) => { | ||
const evalString = strings.map((item, i) => { | ||
return `${item}${args[i] || ''}`; | ||
}).join(''); | ||
const evalString = strings | ||
.map((item, i) => { | ||
return `${item}${args[i] || ""}`; | ||
}) | ||
.join(""); | ||
|
||
const [id, namespace, styles] = evalString.split('||KREMLING||'); | ||
const [id, namespace, styles] = evalString.split("||KREMLING||"); | ||
if (id && namespace && styles) { | ||
return { id, namespace, styles }; | ||
} | ||
return evalString; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
import { k } from './k'; | ||
import { k } from "./k"; | ||
|
||
describe('k', () => { | ||
describe("k", () => { | ||
test(`if kremling separators are used, return an object (postcss)`, () => { | ||
const example = k`k1||KREMLING||kremling||KREMLING||[kremling=k1].test, .test [kremling=k1] { background-color: red; };`; | ||
expect(example).toEqual({ | ||
id: 'k1', | ||
namespace: 'kremling', | ||
styles: '[kremling=k1].test, .test [kremling=k1] { background-color: red; };', | ||
id: "k1", | ||
namespace: "kremling", | ||
styles: | ||
"[kremling=k1].test, .test [kremling=k1] { background-color: red; };", | ||
}); | ||
}); | ||
|
||
test(`if no separators are found, return a string (css)`, () => { | ||
const example = k`&.test { background-color: red; }` | ||
expect(example).toEqual(example) | ||
const example = k`&.test { background-color: red; }`; | ||
expect(example).toEqual(example); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.