Skip to content

Commit

Permalink
unnecessary Style ctor in cascade.spec.js
Browse files Browse the repository at this point in the history
  • Loading branch information
chearon committed Oct 18, 2024
1 parent ddfc87f commit 04dde63
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions test/cascade.spec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//@ts-check

import {createStyle, initialStyle, Style, inherited, initial} from '../src/style.js';
import {createStyle, initialStyle, inherited, initial} from '../src/style.js';
import {BlockContainer} from '../src/layout-flow.js';
import {BoxArea} from '../src/layout-box.js';
import {expect} from 'chai';

describe('CSS Style', function () {
it('calculates used value for border width', function () {
const computed = createStyle(initialStyle, {
const style = createStyle(initialStyle, {
borderTopWidth: 1,
borderTopStyle: 'none',
borderRightWidth: 1,
Expand All @@ -18,7 +18,6 @@ describe('CSS Style', function () {
borderLeftStyle: 'none'
});

const style = new Style(computed);
const box = new BlockContainer(style, [], 0);
box.containingBlock = new BoxArea(box, 0, 0, 100, 100);

Expand All @@ -29,7 +28,7 @@ describe('CSS Style', function () {
});

it('calculates used values for percentages', function () {
const computed = createStyle(initialStyle, {
const style = createStyle(initialStyle, {
paddingTop: {value: 50, unit: '%'},
paddingRight: {value: 50, unit: '%'},
paddingBottom: {value: 50, unit: '%'},
Expand All @@ -42,8 +41,7 @@ describe('CSS Style', function () {
marginLeft: {value: 50, unit: '%'}
});

const style = new Style(computed);
const documentElement = new BlockContainer(new Style(createStyle(initialStyle, {width: 100, height: 200})), [], 0);
const documentElement = new BlockContainer(createStyle(initialStyle, {width: 100, height: 200}), [], 0);
const box = new BlockContainer(style, [], 0);
box.containingBlock = new BoxArea(documentElement, 0, 0, 100, 200);

Expand All @@ -60,7 +58,7 @@ describe('CSS Style', function () {
});

it('normalizes border-box to content-box', function () {
const computed = createStyle(initialStyle, {
const style = createStyle(initialStyle, {
width: 100,
borderLeftWidth: 10,
borderLeftStyle: 'solid',
Expand All @@ -71,14 +69,13 @@ describe('CSS Style', function () {
boxSizing: 'border-box'
});

const style = new Style(computed);
const box = new BlockContainer(style, [], 0);
box.containingBlock = new BoxArea(box, 0, 0, 100, 100);
expect(style.getInlineSize(box)).to.equal(60);
});

it('normalizes padding-box to content-box', function () {
const computed = createStyle(initialStyle, {
const style = createStyle(initialStyle, {
width: 100,
borderLeftWidth: 10,
borderRightWidth: 10,
Expand All @@ -87,7 +84,6 @@ describe('CSS Style', function () {
boxSizing: 'padding-box'
});

const style = new Style(computed);
const box = new BlockContainer(style, [], 0);
box.containingBlock = new BoxArea(box, 0, 0, 100, 100);

Expand Down

0 comments on commit 04dde63

Please sign in to comment.