Skip to content

Commit

Permalink
section metadata autoup code cov
Browse files Browse the repository at this point in the history
  • Loading branch information
Sartxi committed Aug 3, 2023
1 parent d9d7257 commit 6b791d9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
14 changes: 14 additions & 0 deletions test/blocks/section-metadata/mocks/body.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@
</div>
</div>
</div>
<div class="section auto-up">
<div>item</div>
<div>item</div>
<div class="section-metadata">
<div>
<div>style</div>
<div>Darkest, XXL Spacing, auto up</div>
</div>
<div>
<div>background</div>
<div>linear-gradient(red, yellow)</div>
</div>
</div>
</div>
<div class="section image">
<div class="section-metadata">
<div>
Expand Down
12 changes: 11 additions & 1 deletion test/blocks/section-metadata/section-meta.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Section Metdata', () => {
expect(metadata.background.text).to.equal('rgb(239, 239, 239)');
});

it('gets section metadata', () => {
it('gets section to bottom', () => {
const sec = document.querySelector('.section.sticky-bottom');
const sm = sec.querySelector('.section-metadata');
const main = document.querySelector('main');
Expand Down Expand Up @@ -83,4 +83,14 @@ describe('Section Metdata', () => {
await delay(700);
expect(sec.style.top).to.be.eql('77px');
});

it('adds section auto up attributes', async () => {
const sec = document.querySelector('.section.auto-up');
const sm = sec.querySelector('.section-metadata');
await init(sm);
const styles = getComputedStyle(sec);
const variable = styles.getPropertyValue('--section-grid-columns')
expect(sec.classList.contains('auto-up')).to.be.true;
expect(variable).to.be.equal('2');
});
});

0 comments on commit 6b791d9

Please sign in to comment.