Skip to content

Commit

Permalink
fix: make #table style expandable in width
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Jul 22, 2019
1 parent 3940b17 commit 39e2f1d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import ComponentBox from 'Tags/ComponentBox'

The following table has a default style. But in future, there will be several patterns and styles to choose from.

You may consider using `table-layout: fixed;`.

<ComponentBox reactLive hideCode data-dnb-test="table-default">
{`
<table className="dnb-table">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,26 @@ describe('Table screenshot', () => {
setupPageScreenshot({ url: '/uilib/elements/tables' })
it('have to match the default choice of table styles', async () => {
const screenshot = await testPageScreenshot({
style: {
width: '40rem'
},
selector: '[data-dnb-test="table-default"] .dnb-table'
})
expect(screenshot).toMatchImageSnapshot()
})
const style = {
display: 'block',
width: '40rem'
}
const styleSelector = '[data-dnb-test="table-default"] .dnb-table'
it('have to match a sortable table header on hover', async () => {
const selector =
'[data-dnb-test="table-default"] th.dnb-table--sortable:not(.dnb-table--active)'
const screenshot = await testPageScreenshot({
style,
styleSelector,
selector,
simulateSelector: `${selector} button`,
simulateSelector: `${selector} button.dnb-button`,
simulate: 'hover'
})
expect(screenshot).toMatchImageSnapshot()
Expand All @@ -30,8 +40,10 @@ describe('Table screenshot', () => {
const selector =
'[data-dnb-test="table-default"] th.dnb-table--sortable:not(.dnb-table--active)'
const screenshot = await testPageScreenshot({
style,
styleSelector,
selector,
simulateSelector: `${selector} button`,
simulateSelector: `${selector} button.dnb-button`,
simulate: 'focus'
})
expect(screenshot).toMatchImageSnapshot()
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion packages/dnb-ui-lib/src/style/elements/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
@import '../../components/button/style/button-mixins.scss';

@mixin tableStyle() {
display: block;
display: table;
table-layout: auto;
width: 100%;

overflow: auto;
Expand Down

0 comments on commit 39e2f1d

Please sign in to comment.