function testFollowBookmark() {
    var bookmarkContent = Polymer.Base.create('viewer-bookmarks-content', {
      bookmarks: viewer.bookmarks,
      depth: 1
    });

    Polymer.dom.flush();

    var rootBookmarks =
        bookmarkContent.shadowRoot.querySelectorAll('viewer-bookmark');
    chrome.test.assertEq(3, rootBookmarks.length, "three root bookmarks");
    MockInteractions.tap(rootBookmarks[0].$.expand);

    Polymer.dom.flush();

    var subBookmarks =
        rootBookmarks[0].shadowRoot.querySelectorAll('viewer-bookmark');
    chrome.test.assertEq(1, subBookmarks.length, "one sub bookmark");

    var lastPageChange;
    var lastXChange;
    var lastYChange;
    var lastUriNavigation;
    bookmarkContent.addEventListener('change-page', function(e) {
      lastPageChange = e.detail.page;
      lastXChange = undefined;
      lastYChange = undefined;
      lastUriNavigation = undefined;
    });
    bookmarkContent.addEventListener('change-page-and-xy', function(e) {
      lastPageChange = e.detail.page;
      lastXChange = e.detail.x;
      lastYChange = e.detail.y;
      lastUriNavigation = undefined;
    });
    bookmarkContent.addEventListener('navigate', function(e) {
      lastPageChange = undefined;
      lastXChange = undefined;
      lastYChange = undefined;
      lastUriNavigation = e.detail.uri;
    });

    function testTapTarget(tapTarget, expectedEvent) {
      lastPageChange = undefined;
      lastXChange = undefined;
      lastYChange = undefined;
      lastUriNavigation = undefined;
      MockInteractions.tap(tapTarget);
      chrome.test.assertEq(expectedEvent.page, lastPageChange);
      chrome.test.assertEq(expectedEvent.x, lastXChange);
      chrome.test.assertEq(expectedEvent.y, lastYChange);
      chrome.test.assertEq(expectedEvent.uri, lastUriNavigation);
    }

    testTapTarget(rootBookmarks[0].$.item, {page: 0, x: 0, y: 667})
    testTapTarget(subBookmarks[0].$.item, {page: 1, x: 0, y: 667})
    testTapTarget(rootBookmarks[1].$.item, {page: 2, x: 0, y: 667})
    testTapTarget(rootBookmarks[2].$.item, {uri: "http://www.chromium.org"})

    chrome.test.succeed();
  }
/**
   * Test that a bookmark is followed when clicked in test-bookmarks.pdf.
   */
Test that a bookmark is followed when clicked in test-bookmarks.pdf.
Test that a bookmark is followed when clicked in test - bookmarks . pdf .
function testFollowBookmark() {
    var bookmarkContent = Polymer.Base.create('viewer-bookmarks-content', {
      bookmarks: viewer.bookmarks,
      depth: 1
    });
    Polymer.dom.flush();
    var rootBookmarks =
        bookmarkContent.shadowRoot.querySelectorAll('viewer-bookmark');
    chrome.test.assertEq(3, rootBookmarks.length, "three root bookmarks");
    MockInteractions.tap(rootBookmarks[0].$.expand);
    Polymer.dom.flush();
    var subBookmarks =
        rootBookmarks[0].shadowRoot.querySelectorAll('viewer-bookmark');
    chrome.test.assertEq(1, subBookmarks.length, "one sub bookmark");
    var lastPageChange;
    var lastXChange;
    var lastYChange;
    var lastUriNavigation;
    bookmarkContent.addEventListener('change-page', function(e) {
      lastPageChange = e.detail.page;
      lastXChange = undefined;
      lastYChange = undefined;
      lastUriNavigation = undefined;
    });
    bookmarkContent.addEventListener('change-page-and-xy', function(e) {
      lastPageChange = e.detail.page;
      lastXChange = e.detail.x;
      lastYChange = e.detail.y;
      lastUriNavigation = undefined;
    });
    bookmarkContent.addEventListener('navigate', function(e) {
      lastPageChange = undefined;
      lastXChange = undefined;
      lastYChange = undefined;
      lastUriNavigation = e.detail.uri;
    });
    function testTapTarget(tapTarget, expectedEvent) {
      lastPageChange = undefined;
      lastXChange = undefined;
      lastYChange = undefined;
      lastUriNavigation = undefined;
      MockInteractions.tap(tapTarget);
      chrome.test.assertEq(expectedEvent.page, lastPageChange);
      chrome.test.assertEq(expectedEvent.x, lastXChange);
      chrome.test.assertEq(expectedEvent.y, lastYChange);
      chrome.test.assertEq(expectedEvent.uri, lastUriNavigation);
    }
    testTapTarget(rootBookmarks[0].$.item, {page: 0, x: 0, y: 667})
    testTapTarget(subBookmarks[0].$.item, {page: 1, x: 0, y: 667})
    testTapTarget(rootBookmarks[1].$.item, {page: 2, x: 0, y: 667})
    testTapTarget(rootBookmarks[2].$.item, {uri: "http://www.chromium.org"})
    chrome.test.succeed();
  }
function testFollowBookmark ( ) { var bookmarkContent = Polymer . Base . create ( 'viewer-bookmarks-content' , { bookmarks : viewer . bookmarks , depth : 1 } ) ; Polymer . dom . flush ( ) ; var rootBookmarks = bookmarkContent . shadowRoot . querySelectorAll ( 'viewer-bookmark' ) ; chrome . test . assertEq ( 3 , rootBookmarks . length , "three root bookmarks" ) ; MockInteractions . tap ( rootBookmarks [ 0 ] . $ . expand ) ; Polymer . dom . flush ( ) ; var subBookmarks = rootBookmarks [ 0 ] . shadowRoot . querySelectorAll ( 'viewer-bookmark' ) ; chrome . test . assertEq ( 1 , subBookmarks . length , "one sub bookmark" ) ; var lastPageChange ; var lastXChange ; var lastYChange ; var lastUriNavigation ; bookmarkContent . addEventListener ( 'change-page' , function ( e ) { lastPageChange = e . detail . page ; lastXChange = undefined ; lastYChange = undefined ; lastUriNavigation = undefined ; } ) ; bookmarkContent . addEventListener ( 'change-page-and-xy' , function ( e ) { lastPageChange = e . detail . page ; lastXChange = e . detail . x ; lastYChange = e . detail . y ; lastUriNavigation = undefined ; } ) ; bookmarkContent . addEventListener ( 'navigate' , function ( e ) { lastPageChange = undefined ; lastXChange = undefined ; lastYChange = undefined ; lastUriNavigation = e . detail . uri ; } ) ; function testTapTarget ( tapTarget , expectedEvent ) { lastPageChange = undefined ; lastXChange = undefined ; lastYChange = undefined ; lastUriNavigation = undefined ; MockInteractions . tap ( tapTarget ) ; chrome . test . assertEq ( expectedEvent . page , lastPageChange ) ; chrome . test . assertEq ( expectedEvent . x , lastXChange ) ; chrome . test . assertEq ( expectedEvent . y , lastYChange ) ; chrome . test . assertEq ( expectedEvent . uri , lastUriNavigation ) ; } testTapTarget ( rootBookmarks [ 0 ] . $ . item , { page : 0 , x : 0 , y : 667 } ) testTapTarget ( subBookmarks [ 0 ] . $ . item , { page : 1 , x : 0 , y : 667 } ) testTapTarget ( rootBookmarks [ 1 ] . $ . item , { page : 2 , x : 0 , y : 667 } ) testTapTarget ( rootBookmarks [ 2 ] . $ . item , { uri : "http://www.chromium.org" } ) chrome . test . succeed ( ) ; }
Test that a bookmark is followed when clicked in test-bookmarks.pdf.
Test that a bookmark is followed when clicked in test - bookmarks . pdf .