-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(table-of-contents): fix header space (#4298)
### Related Ticket(s) Refs #4262. ### Description This change ensures the area for the heading content is hidden unless there is its content actually. ### Changelog **New** - UI integration test for below change. **Changed** - A change to ensure the area for the heading content is hidden unless there is its content actually.
- Loading branch information
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,6 +159,10 @@ | |
|
||
@include carbon--breakpoint('lg') { | ||
display: block; | ||
|
||
&[hidden] { | ||
display: none; | ||
} | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...ages/web-components/src/components/table-of-contents/__tests__/table-of-contents.steps.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* @license | ||
* | ||
* Copyright IBM Corp. 2020 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
describe('dds-table-of-contents', () => { | ||
describe('With wide screen', () => { | ||
describe('Without heading content', function() { | ||
beforeEach(async () => { | ||
await page.setViewportSize({ width: 1280, height: 720 }); | ||
await page.goto(`http://localhost:${process.env.PORT}/iframe.html?id=components-table-of-contents--default`); | ||
}); | ||
|
||
it('should hide the heading container unless it has its content', async () => { | ||
await expect(page).toHaveSelector('dds-table-of-contents .bx--tableofcontents__desktop__children', { state: 'hidden' }); | ||
}); | ||
}); | ||
|
||
describe('With heading content', () => { | ||
beforeEach(async () => { | ||
await page.setViewportSize({ width: 1280, height: 720 }); | ||
await page.goto(`http://localhost:${process.env.PORT}/iframe.html?id=components-table-of-contents--with-heading-content`); | ||
}); | ||
|
||
it('should show the heading container', async () => { | ||
await expect(page).toHaveSelector('dds-table-of-contents .bx--tableofcontents__desktop__children', { state: 'visible' }); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('With narrow screen', () => { | ||
describe('Without heading content', function() { | ||
beforeEach(async () => { | ||
await page.setViewportSize({ width: 672, height: 720 }); | ||
await page.goto(`http://localhost:${process.env.PORT}/iframe.html?id=components-table-of-contents--default`); | ||
}); | ||
|
||
it('should hide the heading container unless it has its content', async () => { | ||
await expect(page).toHaveSelector('dds-table-of-contents .bx--tableofcontents__children__mobile', { state: 'hidden' }); | ||
}); | ||
}); | ||
|
||
describe('With heading content', () => { | ||
beforeEach(async () => { | ||
await page.setViewportSize({ width: 672, height: 720 }); | ||
await page.goto(`http://localhost:${process.env.PORT}/iframe.html?id=components-table-of-contents--with-heading-content`); | ||
}); | ||
|
||
it('should show the heading container', async () => { | ||
await expect(page).toHaveSelector('dds-table-of-contents .bx--tableofcontents__children__mobile', { state: 'visible' }); | ||
}); | ||
}); | ||
}); | ||
}); |