Skip to content

Commit

Permalink
fix: fix that last value is skipped #71
Browse files Browse the repository at this point in the history
  • Loading branch information
daybrush committed Aug 17, 2020
1 parent fa0ec3f commit 6c67e6e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils/property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ export function splitStyle(str: string) {

const properties = splitText(str, ";");
const obj: IObject<string | PropertyObject> = {};
let length = properties.length;
const totalLength = properties.length;
let length = totalLength;

for (let i = 0; i < length; ++i) {
for (let i = 0; i < totalLength; ++i) {
const matches = splitText(properties[i], ":");

if (matches.length < 2 || !matches[1]) {
Expand Down
7 changes: 7 additions & 0 deletions test/unit/Frame.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ describe("Frame Test", () => {
expect(frame2.get("filter", "brightness")).to.be.equals("90%");
expect(frame2.get("filter", "grayscale")).to.be.equals("50%");
});
it("should check `set` method with no value", () => {
// Given, When
frame.set(`text-shadow:5px 5px 5px;-webkit-mask-image:;filter:blur(6px);`);

// Then
expect(frame.has("filter", "blur")).to.be.equals(true);
});
it("sholud check remove method", () => {
// Given, When
frame.remove("a");
Expand Down

0 comments on commit 6c67e6e

Please sign in to comment.