function testZoomToolbarToggle() {
    var zoomToolbar = Polymer.Base.create('viewer-zoom-toolbar', {});
    var fitButton = zoomToolbar.$['fit-button'];
    var fab = fitButton.$['button'];

    var fitWidthIcon = 'fullscreen';
    var fitPageIcon = 'fullscreen-exit';

    var fitToEventChecker = new FitToEventChecker(zoomToolbar);

    // Initial: Show fit-to-page.
    // TODO(tsergeant): This assertion attempts to be resilient to iconset
    // changes. A better solution is something like
    // https://github.com/PolymerElements/iron-icon/issues/68.
    chrome.test.assertTrue(fab.icon.endsWith(fitPageIcon));

    // Tap 1: Fire fit-to-changed(FIT_TO_PAGE), show fit-to-width.
    MockInteractions.tap(fab);
    fitToEventChecker.assertEvent(FittingType.FIT_TO_PAGE, true);
    chrome.test.assertTrue(fab.icon.endsWith(fitWidthIcon));

    // Tap 2: Fire fit-to-changed(FIT_TO_WIDTH), show fit-to-page.
    MockInteractions.tap(fab);
    fitToEventChecker.assertEvent(FittingType.FIT_TO_WIDTH, true);
    chrome.test.assertTrue(fab.icon.endsWith(fitPageIcon));

    // Tap 3: Fire fit-to-changed(FIT_TO_PAGE) again.
    MockInteractions.tap(fab);
    fitToEventChecker.assertEvent(FittingType.FIT_TO_PAGE, true);
    chrome.test.assertTrue(fab.icon.endsWith(fitWidthIcon));

    // Do the same as above, but with fitToggleFromHotKey().
    zoomToolbar.fitToggleFromHotKey();
    fitToEventChecker.assertEvent(FittingType.FIT_TO_WIDTH, true);
    chrome.test.assertTrue(fab.icon.endsWith(fitPageIcon));
    zoomToolbar.fitToggleFromHotKey();
    fitToEventChecker.assertEvent(FittingType.FIT_TO_PAGE, true);
    chrome.test.assertTrue(fab.icon.endsWith(fitWidthIcon));
    zoomToolbar.fitToggleFromHotKey();
    fitToEventChecker.assertEvent(FittingType.FIT_TO_WIDTH, true);
    chrome.test.assertTrue(fab.icon.endsWith(fitPageIcon));

    // Tap 4: Fire fit-to-changed(FIT_TO_PAGE) again.
    MockInteractions.tap(fab);
    fitToEventChecker.assertEvent(FittingType.FIT_TO_PAGE, true);
    chrome.test.assertTrue(fab.icon.endsWith(fitWidthIcon));

    chrome.test.succeed();
  }
/**
   * Test that the zoom toolbar toggles between showing the fit-to-page and
   * fit-to-width buttons.
   */
Test that the zoom toolbar toggles between showing the fit-to-page and
fit-to-width buttons.
Test that the zoom toolbar toggles between showing the fit - to - page and fit - to - width buttons .
function testZoomToolbarToggle() {
    var zoomToolbar = Polymer.Base.create('viewer-zoom-toolbar', {});
    var fitButton = zoomToolbar.$['fit-button'];
    var fab = fitButton.$['button'];
    var fitWidthIcon = 'fullscreen';
    var fitPageIcon = 'fullscreen-exit';
    var fitToEventChecker = new FitToEventChecker(zoomToolbar);
    chrome.test.assertTrue(fab.icon.endsWith(fitPageIcon));
    MockInteractions.tap(fab);
    fitToEventChecker.assertEvent(FittingType.FIT_TO_PAGE, true);
    chrome.test.assertTrue(fab.icon.endsWith(fitWidthIcon));
    MockInteractions.tap(fab);
    fitToEventChecker.assertEvent(FittingType.FIT_TO_WIDTH, true);
    chrome.test.assertTrue(fab.icon.endsWith(fitPageIcon));
    MockInteractions.tap(fab);
    fitToEventChecker.assertEvent(FittingType.FIT_TO_PAGE, true);
    chrome.test.assertTrue(fab.icon.endsWith(fitWidthIcon));
    zoomToolbar.fitToggleFromHotKey();
    fitToEventChecker.assertEvent(FittingType.FIT_TO_WIDTH, true);
    chrome.test.assertTrue(fab.icon.endsWith(fitPageIcon));
    zoomToolbar.fitToggleFromHotKey();
    fitToEventChecker.assertEvent(FittingType.FIT_TO_PAGE, true);
    chrome.test.assertTrue(fab.icon.endsWith(fitWidthIcon));
    zoomToolbar.fitToggleFromHotKey();
    fitToEventChecker.assertEvent(FittingType.FIT_TO_WIDTH, true);
    chrome.test.assertTrue(fab.icon.endsWith(fitPageIcon));
    MockInteractions.tap(fab);
    fitToEventChecker.assertEvent(FittingType.FIT_TO_PAGE, true);
    chrome.test.assertTrue(fab.icon.endsWith(fitWidthIcon));
    chrome.test.succeed();
  }
function testZoomToolbarToggle ( ) { var zoomToolbar = Polymer . Base . create ( 'viewer-zoom-toolbar' , { } ) ; var fitButton = zoomToolbar . $ [ 'fit-button' ] ; var fab = fitButton . $ [ 'button' ] ; var fitWidthIcon = 'fullscreen' ; var fitPageIcon = 'fullscreen-exit' ; var fitToEventChecker = new FitToEventChecker ( zoomToolbar ) ; chrome . test . assertTrue ( fab . icon . endsWith ( fitPageIcon ) ) ; MockInteractions . tap ( fab ) ; fitToEventChecker . assertEvent ( FittingType . FIT_TO_PAGE , true ) ; chrome . test . assertTrue ( fab . icon . endsWith ( fitWidthIcon ) ) ; MockInteractions . tap ( fab ) ; fitToEventChecker . assertEvent ( FittingType . FIT_TO_WIDTH , true ) ; chrome . test . assertTrue ( fab . icon . endsWith ( fitPageIcon ) ) ; MockInteractions . tap ( fab ) ; fitToEventChecker . assertEvent ( FittingType . FIT_TO_PAGE , true ) ; chrome . test . assertTrue ( fab . icon . endsWith ( fitWidthIcon ) ) ; zoomToolbar . fitToggleFromHotKey ( ) ; fitToEventChecker . assertEvent ( FittingType . FIT_TO_WIDTH , true ) ; chrome . test . assertTrue ( fab . icon . endsWith ( fitPageIcon ) ) ; zoomToolbar . fitToggleFromHotKey ( ) ; fitToEventChecker . assertEvent ( FittingType . FIT_TO_PAGE , true ) ; chrome . test . assertTrue ( fab . icon . endsWith ( fitWidthIcon ) ) ; zoomToolbar . fitToggleFromHotKey ( ) ; fitToEventChecker . assertEvent ( FittingType . FIT_TO_WIDTH , true ) ; chrome . test . assertTrue ( fab . icon . endsWith ( fitPageIcon ) ) ; MockInteractions . tap ( fab ) ; fitToEventChecker . assertEvent ( FittingType . FIT_TO_PAGE , true ) ; chrome . test . assertTrue ( fab . icon . endsWith ( fitWidthIcon ) ) ; chrome . test . succeed ( ) ; }
Test that the zoom toolbar toggles between showing the fit-to-page and
 fit-to-width buttons.
Test that the zoom toolbar toggles between showing the fit - to - page and fit - to - width buttons .
// Initial: Show fit-to-page. // TODO(tsergeant): This assertion attempts to be resilient to iconset // changes. A better solution is something like // https://github.com/PolymerElements/iron-icon/issues/68. // Tap 1: Fire fit-to-changed(FIT_TO_PAGE), show fit-to-width. // Tap 2: Fire fit-to-changed(FIT_TO_WIDTH), show fit-to-page. // Tap 3: Fire fit-to-changed(FIT_TO_PAGE) again. // Do the same as above, but with fitToggleFromHotKey(). // Tap 4: Fire fit-to-changed(FIT_TO_PAGE) again.