-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show "Publish: Immediately" for new drafts by inferring floating date (…
…#9967) * Show "Publish: Immediately" for new drafts by inferring floating date * Add isEditedPostDateFloating selector Move logic to determine whether a post should be considered to have a floating date from the PostScheduleLabel component into a new selector isEditedPostDateFloating. * Rename "floating" component property to "isFloating" for type clarity
- Loading branch information
1 parent
78d1254
commit af53caa
Showing
4 changed files
with
132 additions
and
2 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
28 changes: 28 additions & 0 deletions
28
packages/editor/src/components/post-schedule/test/label.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,28 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { shallow } from 'enzyme'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { PostScheduleLabel } from '../label'; | ||
|
||
describe( 'PostScheduleLabel', () => { | ||
it( 'should show the post will be published immediately if no publish date is set', () => { | ||
const wrapper = shallow( <PostScheduleLabel date={ undefined } /> ); | ||
expect( wrapper.text() ).toBe( 'Immediately' ); | ||
} ); | ||
|
||
it( 'should show the post will be published immediately if it has a floating date', () => { | ||
const date = '2018-09-17T01:23:45.678Z'; | ||
const wrapper = shallow( <PostScheduleLabel date={ date } isFloating={ true } /> ); | ||
expect( wrapper.text() ).toBe( 'Immediately' ); | ||
} ); | ||
|
||
it( 'should show the scheduled publish date if a date has been set', () => { | ||
const date = '2018-09-17T01:23:45.678Z'; | ||
const wrapper = shallow( <PostScheduleLabel date={ date } isFloating={ false } /> ); | ||
expect( wrapper.text() ).not.toBe( 'Immediately' ); | ||
} ); | ||
} ); |
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