[FIX] website tour: create a stub for bootstrap tour in automatic/test mode

bzr revid: chm@openerp.com-20140313142258-wblpqpwp9oubboc9
This commit is contained in:
chm@openerp.com 2014-03-13 15:22:58 +01:00
parent ba63094b9b
commit aa412d99ec
2 changed files with 17 additions and 1 deletions

View File

@ -3,9 +3,22 @@
var website = openerp.website;
// don't need template to use bootstrap Tour in automatic mode
if (typeof QWeb2 !== "undefined")
website.add_template_file('/website/static/src/xml/website.tour.xml');
// don't need to use bootstrap Tour to launch an automatic tour
function bootstrap_tour_stub () {
if (typeof Tour === "undefined") {
window.Tour = function Tour() {};
Tour.prototype.addSteps = function () {};
Tour.prototype.end = function () {};
Tour.prototype.goto = function () {};
}
}
if (website.EditorBar)
website.EditorBar.include({
tours: [],
@ -175,6 +188,9 @@ website.Tour = openerp.Class.extend({
},
registerTour: function () {
if (this.automatic) {
bootstrap_tour_stub();
}
this.tour = new Tour({
name: this.id,
storage: this.tourStorage,

View File

@ -14,7 +14,7 @@ class TestUi(openerp.tests.HttpCase):
self.phantom_js("/", "openerp.website.Tour.run_test('shop')", "openerp.website.Tour.Shop", login="admin")
def test_02_admin_checkout(self):
self.phantom_js("/", "openerp.website.Tour.run_test('shop_buy_product')", "openerp.website.Tour", login="admin")
self.phantom_js("/", "openerp.website.Tour.run_test('shop_buy_product')", "openerp.website.Tour", login="admin", inject=inject)
def test_03_demo_checkout(self):
self.phantom_js("/", "openerp.website.Tour.run_test('shop_buy_product')", "openerp.website.Tour.ShopTest", login="demo", inject=inject)