1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
# Copyright 2013 Canonical
4
# This program is free software: you can redistribute it and/or modify it
5
# under the terms of the GNU Lesser General Public License version 3, as published
6
# by the Free Software Foundation.
8
from __future__ import absolute_import
12
from testtools.matchers import Contains, Equals
13
from autopilot.matchers import Eventually
15
from ubuntu_html5_ui_toolkit.tests import UbuntuHTML5TestCaseBase, UbuntuThemeRemotePageTestCaseBase
17
class UbuntuThemePageStackTestCase(UbuntuHTML5TestCaseBase):
20
super(UbuntuThemePageStackTestCase, self).setUp()
22
def test_pageLoadsWithNoPageStacks(self):
23
self.browse_to_test_html('test-nopagestack-in-app.html')
24
self.assertThat(self.eval_expression_in_page_unsafe('var UI = new UbuntuUI(); UI.init(); return "ok";'), Equals('ok'));
26
def test_pageLoadsWithPageStacks(self):
27
self.browse_to_test_html('test-pagestack-in-app.html')
28
self.assertThat(self.eval_expression_in_page_unsafe('var UI = new UbuntuUI(); UI.init(); return "ok";'), Equals('ok'));
29
self.assertThat(self.is_dom_node_visible('main'), Equals(True))
31
def test_pageChangeWithPageStackPush(self):
32
self.browse_to_test_html('test-pagestack-in-app.html')
33
self.assertThat(self.eval_expression_in_page_unsafe('var UI = new UbuntuUI(); UI.init(); UI.pagestack.push("results"); return "ok";'), Equals('ok'));
34
self.assertThat(self.is_dom_node_visible('main'), Equals(False))
35
self.assertThat(self.is_dom_node_visible('results'), Equals(True))
37
def test_pageChangeWithPageStackPopped(self):
38
self.browse_to_test_html('test-pagestack-in-app.html')
39
self.assertThat(self.eval_expression_in_page_unsafe('var UI = new UbuntuUI(); UI.init(); UI.pagestack.push("main"); UI.pagestack.push("results"); UI.pagestack.push("article"); UI.pagestack.pop(); return "ok";'), Equals('ok'));
40
self.assertThat(self.is_dom_node_visible('main'), Equals(False))
41
self.assertThat(self.is_dom_node_visible('results'), Equals(True))
42
self.assertThat(self.is_dom_node_visible('article'), Equals(False))