From 84b0da12aea092d175b7c8071d3ebd1365069539 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 10 Mar 2011 10:23:56 +0100 Subject: [PATCH] [TEST] add tests for t-raw and t-rawf, fix rawf which has apparently been broken since forever ago bzr revid: xmo@openerp.com-20110310092356-xgfyjpdct2afotbv --- addons/base/static/qweb/qweb-test-output.xml | 25 ++++++++++++++++++++ addons/base/static/qweb/qweb-test.js.html | 14 +++++++++++ addons/base/static/qweb/qweb.js | 2 +- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/addons/base/static/qweb/qweb-test-output.xml b/addons/base/static/qweb/qweb-test-output.xml index 6bb6c887b52..2660e519273 100644 --- a/addons/base/static/qweb/qweb-test-output.xml +++ b/addons/base/static/qweb/qweb-test-output.xml @@ -23,4 +23,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/addons/base/static/qweb/qweb-test.js.html b/addons/base/static/qweb/qweb-test.js.html index 9500453c228..dfe7d225285 100644 --- a/addons/base/static/qweb/qweb-test.js.html +++ b/addons/base/static/qweb/qweb-test.js.html @@ -40,6 +40,20 @@ equals('[<ok>]', render('escf-format-variable-with-escapes', {value: ''}), "Render a formatted string with data to escape"); }); + test("Basic unescaped output", function () { + equals("ok", render('raw-literal', {}), "Render a literal string"); + equals("ok", render('raw-variable', {ok: 'ok'}), "Render a string variable"); + equals("", render('raw-notescaped', {ok: ''}), "Render a string with data not escaped"); + }); + test("Formatted unescaped output", function () { + equals("ok", render('rawf-noformat-literal', {}), "Render a literal string"); + equals("ok", render('rawf-simpleformat-variable', {value: 'ok'}), + "Only render an interpolated variable"); + equals("[ok]", render('rawf-format-variable', {value: 'ok'}), + "Actually formatted variable"); + equals('[]', render('rawf-format-variable-notescaped', {value: ''}), + "Render a formatted string with data not escaped"); + }); }); diff --git a/addons/base/static/qweb/qweb.js b/addons/base/static/qweb/qweb.js index e8a614f4104..a114371b1c7 100644 --- a/addons/base/static/qweb/qweb.js +++ b/addons/base/static/qweb/qweb.js @@ -174,7 +174,7 @@ var QWeb = { return this.eval_str(t_att["raw"], v); }, render_tag_rawf:function(e, t_att, g_att, v) { - return this.eval_format(t_att["raw"], v); + return this.eval_format(t_att["rawf"], v); }, render_tag_esc:function(e, t_att, g_att, v) { return this.escape_text(this.eval_str(t_att["esc"], v));