Skip to content

Commit

Permalink
test: add test for sliver item
Browse files Browse the repository at this point in the history
  • Loading branch information
wssgcg1213 committed Apr 27, 2022
1 parent 71a6389 commit ac7003a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 21 additions & 4 deletions integration_tests/specs/css/css-display/sliver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,15 @@ describe('display sliver', () => {
done();
});
});

it('sliver child is text or comment', async () => {
var comment = document.createComment('HelloWorld');
var text = document.createTextNode('HelloWorld');
// Empty text node has different logic in backend.
var emptyText = document.createTextNode('');

var container = createSliverBasicCase();

container.insertBefore(emptyText, container.firstChild);
container.insertBefore(text, container.firstChild);
container.insertBefore(comment, container.firstChild);
Expand All @@ -219,7 +219,7 @@ describe('display sliver', () => {

it('sliver child is display none', async () => {
var container = createSliverBasicCase();

container.children[2].style.display = 'none';
await snapshot(); // Not throws error is ok.
});
Expand Down Expand Up @@ -252,12 +252,29 @@ describe('display sliver', () => {
var container = createSliverBasicCase();
var firstChild = container.firstChild; // should be element.
firstChild.style.position = 'relative';

var innerChild = document.createElement('div');
innerChild.appendChild(document.createTextNode('helloworld'));
innerChild.style.position = 'relative';
innerChild.style.top = innerChild.style.left = '15px';
firstChild?.appendChild(innerChild);
await snapshot();
});

it('sliver item absolute', async () => {
var container = createSliverBasicCase();
document.body.appendChild(container);

var absoluted = document.createElement('div');
Object.assign(absoluted.style, {
width: '10px',
height: '10px',
position: 'absolute',
background: 'green',
top: 0,
right: 0,
});
container.childNodes[1].appendChild(absoluted);
await snapshot();
});
});

0 comments on commit ac7003a

Please sign in to comment.