conditionally hide load prior items button

fixes ADMIN-909

test plan:
- if there are past items to load, you should be able to tab to the
load prior items button
- if all past items are loaded, the load prior items button should be
missing.

Change-Id: Ibbe46802a26ae09419fe7c26e7861a586698e7e6
Reviewed-on: https://gerrit.instructure.com/147189
Tested-by: Jenkins
Reviewed-by: Mysti Sadler <mysti@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jon Willesen <jonw+gerrit@instructure.com>
This commit is contained in:
Jon Willesen 2018-04-17 11:23:44 -06:00 committed by Jon Willesen
parent c8d466fbae
commit 0fa4012da2
2 changed files with 11 additions and 0 deletions

View File

@ -94,3 +94,13 @@ it('shows new activity button when there is new activity, but no current items',
/>);
expect(wrapper.find('StickyButton')).toHaveLength(1);
});
it('shows load prior items button when there is more to load', () => {
const wrapper = shallow(<PlannerApp {...getDefaultValues()} />);
expect(wrapper.find('ShowOnFocusButton')).toHaveLength(1);
});
it('does not show load prior items button when all past items are loaded', () => {
const wrapper = shallow(<PlannerApp {...getDefaultValues()} allPastItemsLoaded />);
expect(wrapper.find('ShowOnFocusButton')).toHaveLength(0);
});

View File

@ -148,6 +148,7 @@ export class PlannerApp extends Component {
}
renderLoadPastButton () {
if (this.props.allPastItemsLoaded) return;
return (
<ShowOnFocusButton
buttonProps={{