Home | History | Annotate | Download | only in test
      1 <!doctype html>
      2 <!--
      3 @license
      4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
      5 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
      6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
      7 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
      8 Code distributed by Google as part of the polymer project is also
      9 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
     10 -->
     11 
     12 <html>
     13 <head>
     14   <title>iron-a11y-announcer</title>
     15 
     16   <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
     17   <script src="../../web-component-tester/browser.js"></script>
     18 
     19   <link rel="import" href="../../polymer/polymer.html">
     20   <link rel="import" href="../iron-a11y-announcer.html">
     21 </head>
     22 <body>
     23 
     24   <test-fixture id="Announcer">
     25     <template>
     26       <iron-a11y-announcer></iron-a11y-announcer>
     27     </template>
     28   </test-fixture>
     29 
     30   <script>
     31     suite('<iron-a11y-announcer>', function() {
     32       var announcer;
     33 
     34       setup(function() {
     35         announcer = fixture('Announcer');
     36       });
     37 
     38       test('announces when there is an iron-announce event', function() {
     39         var event = new CustomEvent('iron-announce', {
     40           bubbles: true,
     41           detail: {
     42             text: 'foo'
     43           }
     44         });
     45 
     46         sinon.spy(announcer, 'announce');
     47 
     48         document.body.dispatchEvent(event);
     49 
     50         expect(announcer.announce.callCount).to.be.equal(1);
     51       });
     52     });
     53   </script>
     54 
     55 </body>
     56 </html>
     57