From 281fafff1b510b0eb0167710bf40c6b14dcab728 Mon Sep 17 00:00:00 2001 From: Naomi Dushay Date: Thu, 8 Sep 2016 15:02:20 -0700 Subject: [PATCH] image viewer thumb filmstrip now closed by default, like media viewer thumbstrip --- app/assets/javascripts/modules/image_x_viewer.js | 3 ++- app/assets/javascripts/modules/layout_store.js | 2 +- spec/features/image_x_viewer_spec.rb | 11 +++++++---- spec/javascripts/layout_store/layout_store_spec.js | 6 +++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/modules/image_x_viewer.js b/app/assets/javascripts/modules/image_x_viewer.js index a2f42aec3..bf1429fb8 100644 --- a/app/assets/javascripts/modules/image_x_viewer.js +++ b/app/assets/javascripts/modules/image_x_viewer.js @@ -433,7 +433,7 @@ $thumbSlider = $(document.createElement('div')); $thumbSlider.addClass('sul-embed-image-x-thumb-slider'); $thumbOpenClose = $(document.createElement('div')); - $thumbOpenClose.addClass('sul-i-navigation-show-more-1 open ' + + $thumbOpenClose.addClass('sul-i-navigation-show-more-1 ' + 'sul-embed-image-x-thumb-slider-open-close'); $thumbOpenClose.attr('aria-label', 'toggle thumbnail viewer'); $thumbOpenClose.attr('aria-expanded', true); @@ -497,6 +497,7 @@ }).init(); _loadImages($thumbSlider); + $thumbSlider.hide(); thumbSliderSly.on('load move', function() { _loadImages($thumbSlider); diff --git a/app/assets/javascripts/modules/layout_store.js b/app/assets/javascripts/modules/layout_store.js index b43655b16..71e209b30 100644 --- a/app/assets/javascripts/modules/layout_store.js +++ b/app/assets/javascripts/modules/layout_store.js @@ -19,7 +19,7 @@ _this.state({ authorized: false, bottomPanelEnabled: true, - bottomPanelOpen: true, + bottomPanelOpen: false, fullscreen: true, overviewPerspectiveAvailable: false, keyboardNavMode: null diff --git a/spec/features/image_x_viewer_spec.rb b/spec/features/image_x_viewer_spec.rb index 9f915310b..b63514a58 100644 --- a/spec/features/image_x_viewer_spec.rb +++ b/spec/features/image_x_viewer_spec.rb @@ -16,15 +16,15 @@ end end describe 'thumbnail viewer' do - it 'is open by default' do + it 'is closed by default' do within '.sul-embed-image-x-thumb-slider-container' do expect(page).to have_css '.sul-embed-image-x-thumb-slider-open-close', visible: true expect(page).to have_css '.sul-embed-thumb-slider-scroll', visible: true - expect(page).to have_css '.sul-embed-image-x-thumb-slider', visible: true - expect(page).to have_css 'img', count: 36 + expect(page).to have_css '.sul-embed-image-x-thumb-slider', visible: false end find('.sul-embed-image-x-thumb-slider-open-close').click - expect(page).to have_css '.sul-embed-image-x-thumb-slider', visible: false + expect(page).to have_css '.sul-embed-image-x-thumb-slider', visible: true + expect(page).to have_css 'img', count: 36 end describe 'is hidden when in overview' do before do @@ -43,6 +43,7 @@ end describe 'keyboard controls' do it 'navigates left and right' do + find('.sul-embed-image-x-thumb-slider-open-close').click expect(page).to have_css '.active[title="Image 1"]' container = find('.sul-embed-container') container.native.send_key(:Right) @@ -51,6 +52,7 @@ expect(page).to have_css '.active[title="Image 1"]' end it 'in overview navigate left/right' do + find('.sul-embed-image-x-thumb-slider-open-close').click expect(page).to have_css '.active[title="Image 1"]' find('[data-sul-view-perspective="overview"]').click container = find('.sul-embed-container') @@ -60,6 +62,7 @@ expect(page).to have_css '.active[title="Image 1"]' end it 'with closed thumb slider' do + find('.sul-embed-image-x-thumb-slider-open-close').click expect(page).to have_css '.active[title="Image 1"]' find('.sul-embed-image-x-thumb-slider-open-close').click expect(page).to have_css '.sul-embed-image-x-thumb-slider-container', diff --git a/spec/javascripts/layout_store/layout_store_spec.js b/spec/javascripts/layout_store/layout_store_spec.js index 87ea9399b..f5f6428d6 100644 --- a/spec/javascripts/layout_store/layout_store_spec.js +++ b/spec/javascripts/layout_store/layout_store_spec.js @@ -28,11 +28,11 @@ describe('LayoutStore', function() { expect(layoutStore.layoutState).toEqual({ authorized: false, bottomPanelEnabled: true, - bottomPanelOpen: true, + bottomPanelOpen: false, fullscreen: true, overviewPerspectiveAvailable: false, keyboardNavMode: null - }); + }); expect(storeSpy).not.toHaveBeenCalled(); done(); }); @@ -40,7 +40,7 @@ describe('LayoutStore', function() { describe('bottomPanelOpen', function() { it('reverses the state', function(done) { PubSub.publishSync('thumbSliderToggle'); - expect(layoutStore.layoutState.bottomPanelOpen).toBe(false); + expect(layoutStore.layoutState.bottomPanelOpen).toBe(true); done(); }); });