Skip to content

Commit

Permalink
Added missing unit tests for bug #8
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaakko Heusala committed Feb 2, 2024
1 parent 2b906d8 commit 991d08a
Showing 1 changed file with 182 additions and 0 deletions.
182 changes: 182 additions & 0 deletions entities/style/StyleEntity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,32 @@ describe('StyleEntity', () => {
})
);
});
it('can set top margin by number two times', () => {
entity.setRightMargin(10);
entity.setRightMargin(100);
expect(entity.getDTO()).toEqual(
expect.objectContaining({
margin: expect.objectContaining({
top: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
right: expect.objectContaining({
value: 100,
unit: UnitType.PX,
}),
bottom: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
left: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
})
})
);
});
});

describe('.setBottomMargin', () => {
Expand Down Expand Up @@ -481,6 +507,32 @@ describe('StyleEntity', () => {
})
);
});
it('can set top margin by number two times', () => {
entity.setBottomMargin(10);
entity.setBottomMargin(100);
expect(entity.getDTO()).toEqual(
expect.objectContaining({
margin: expect.objectContaining({
top: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
right: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
bottom: expect.objectContaining({
value: 100,
unit: UnitType.PX,
}),
left: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
})
})
);
});
});

describe('.setLeftMargin', () => {
Expand Down Expand Up @@ -509,6 +561,32 @@ describe('StyleEntity', () => {
})
);
});
it('can set top margin by number two times', () => {
entity.setLeftMargin(10);
entity.setLeftMargin(100);
expect(entity.getDTO()).toEqual(
expect.objectContaining({
margin: expect.objectContaining({
top: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
right: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
bottom: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
left: expect.objectContaining({
value: 100,
unit: UnitType.PX,
}),
})
})
);
});
});


Expand Down Expand Up @@ -624,6 +702,32 @@ describe('StyleEntity', () => {
})
);
});
it('can set top padding by number two times', () => {
entity.setTopPadding(10);
entity.setTopPadding(100);
expect(entity.getDTO()).toEqual(
expect.objectContaining({
padding: expect.objectContaining({
top: expect.objectContaining({
value: 100,
unit: UnitType.PX,
}),
right: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
bottom: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
left: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
})
})
);
});
});

describe('.setRightPadding', () => {
Expand Down Expand Up @@ -652,6 +756,32 @@ describe('StyleEntity', () => {
})
);
});
it('can set top padding by number two times', () => {
entity.setRightPadding(10);
entity.setRightPadding(100);
expect(entity.getDTO()).toEqual(
expect.objectContaining({
padding: expect.objectContaining({
top: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
right: expect.objectContaining({
value: 100,
unit: UnitType.PX,
}),
bottom: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
left: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
})
})
);
});
});

describe('.setBottomPadding', () => {
Expand Down Expand Up @@ -680,6 +810,32 @@ describe('StyleEntity', () => {
})
);
});
it('can set top padding by number two times', () => {
entity.setBottomPadding(10);
entity.setBottomPadding(100);
expect(entity.getDTO()).toEqual(
expect.objectContaining({
padding: expect.objectContaining({
top: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
right: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
bottom: expect.objectContaining({
value: 100,
unit: UnitType.PX,
}),
left: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
})
})
);
});
});

describe('.setLeftPadding', () => {
Expand Down Expand Up @@ -708,6 +864,32 @@ describe('StyleEntity', () => {
})
);
});
it('can set top padding by number two times', () => {
entity.setLeftPadding(10);
entity.setLeftPadding(100);
expect(entity.getDTO()).toEqual(
expect.objectContaining({
padding: expect.objectContaining({
top: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
right: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
bottom: expect.objectContaining({
value: 10,
unit: UnitType.PX,
}),
left: expect.objectContaining({
value: 100,
unit: UnitType.PX,
}),
})
})
);
});
});


Expand Down

0 comments on commit 991d08a

Please sign in to comment.