-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notices: Make non-dismissible notices push content down #12301
Closed
noisysocks
wants to merge
6
commits into
master
from
try/make-non-dismissible-notices-push-content-down
Closed
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2ac11f1
Notices: Make non-dismissible notices push content down
noisysocks 9a8ca8a
Try slightly alternate approach.
0daf17a
Components: Merge NoticeList classes with default
aduth d2599e2
Document change to how behaves
noisysocks b285699
Fix scrolling on iPhone and mobile.
bb60bcf
Fix issue with lingering obsolete rule.
jasmussen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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,26 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import ShallowRenderer from 'react-test-renderer/shallow'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import TokenList from '@wordpress/token-list'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import NoticeList from '../list'; | ||
|
||
describe( 'NoticeList', () => { | ||
it( 'should merge className', () => { | ||
const renderer = new ShallowRenderer(); | ||
|
||
renderer.render( <NoticeList notices={ [] } className="is-ok" /> ); | ||
|
||
const classes = new TokenList( renderer.getRenderOutput().props.className ); | ||
expect( classes.contains( 'is-ok' ) ).toBe( true ); | ||
expect( classes.contains( 'components-notice-list' ) ).toBe( true ); | ||
} ); | ||
} ); |
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
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
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
35 changes: 35 additions & 0 deletions
35
packages/editor/src/components/editor-notices/test/index.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,35 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { shallow } from 'enzyme'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { EditorNotices } from '../'; | ||
|
||
describe( 'EditorNotices', () => { | ||
const notices = [ | ||
{ content: 'Eat your vegetables!', isDismissible: true }, | ||
{ content: 'Brush your teeth!', isDismissible: true }, | ||
{ content: 'Existence is fleeting!', isDismissible: false }, | ||
]; | ||
|
||
it( 'renders all notices', () => { | ||
const wrapper = shallow( <EditorNotices notices={ notices } /> ); | ||
expect( wrapper.prop( 'notices' ) ).toHaveLength( 3 ); | ||
expect( wrapper.children() ).toHaveLength( 1 ); | ||
} ); | ||
|
||
it( 'renders only dismissible notices', () => { | ||
const wrapper = shallow( <EditorNotices notices={ notices } dismissible={ true } /> ); | ||
expect( wrapper.prop( 'notices' ) ).toHaveLength( 2 ); | ||
expect( wrapper.children() ).toHaveLength( 1 ); | ||
} ); | ||
|
||
it( 'renders only non-dismissible notices', () => { | ||
const wrapper = shallow( <EditorNotices notices={ notices } dismissible={ false } /> ); | ||
expect( wrapper.prop( 'notices' ) ).toHaveLength( 1 ); | ||
expect( wrapper.children() ).toHaveLength( 0 ); | ||
} ); | ||
} ); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It existed before, but I don't think it's the
NoticeList
component itself which should need to receive az-index
, but rather its specific usage in the editor as appearing above other content. We could reflect this by applying (merging) a class name specific to the editor notice's list.editor-editor-notices__notice-list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried removing the z-index because I agree. But then this happens:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it needs to exist, just not targeting
NoticeList
broadly, because aNoticeList
could be rendered anywhere, not necessarily as we have it above content. So thez-index
ought to be targeted to the more specific component which needs it (EditorNotices
).Not something which ought to be done here I think.