UNPKG

720 BJavaScriptView Raw
1/**
2 * Test case for apHistory.
3 * Runs with mocha.
4 */
5'use strict'
6
7const ApHistory = require('../lib/ap_history.js')
8const assert = require('assert')
9
10describe('ap-history', () => {
11 before((done) => {
12 global.history = global.history ||
13 {
14 pushState() {
15
16 }
17 }
18 done()
19 })
20
21 after((done) => {
22 done()
23 })
24
25 it('Ap demo class', (done) => {
26 let apHistory = new ApHistory({
27 _getWindow () {
28 return {
29 addEventListener () {},
30 removeEventListener () {}
31 }
32 }
33 })
34 apHistory.push('/foo/bar')
35
36 function pop () {}
37
38 apHistory.onPop(pop)
39 apHistory.offPop(pop)
40 done()
41 })
42})
43
44/* global describe, before, after, it */