[TEST] attribute-addition features

bzr revid: xmo@openerp.com-20110310121827-im1lnvwor0x97ear
This commit is contained in:
Xavier Morel
2011-03-10 13:18:27 +01:00
parent 5489bb8ebb
commit 12e140872c
2 changed files with 51 additions and 0 deletions
@@ -0,0 +1,22 @@
<templates>
<t t-name="fixed-literal">
<div t-att-foo="'bar'"/>
</t>
<t t-name="fixed-variable">
<div t-att-foo="value"/>
</t>
<t t-name="tuple-literal">
<div t-att="['foo', 'bar']"/>
</t>
<t t-name="tuple-variable">
<div t-att="att"/>
</t>
<t t-name="format-literal">
<div t-attf-foo="bar"/>
</t>
<t t-name="format-value">
<div t-attf-foo="b#{value}r"/>
</t>
</templates>
+29
View File
@@ -130,6 +130,35 @@
equals(render('lower-or-equal-js', {}), 'ok',
"Lower or Equal, JS operator");
});
module("Attributes manipulation", {
setup: function () {
QWeb.add_template('qweb-test-attributes.xml');
},
teardown: function () {
QWeb.templates = [];
QWeb.tag = {};
QWeb.att = {};
}
});
test('Fixed-name attributes', function () {
equals(render('fixed-literal', {}), '<div foo="bar"/>',
"Fixed name and literal attribute value");
equals(render('fixed-variable', {value: 'ok'}), '<div foo="ok"/>',
"Fixed name and variable attribute value");
});
test('Tuple-based attributes', function () {
equals(render('tuple-literal', {}), '<div foo="bar"/>',
"Tuple-based literal attributes");
equals(render('tuple-variable', {att: ['foo', 'bar']}), '<div foo="bar"/>',
"Tuple-based variable attributes");
});
test('Fixed name, formatted value attributes', function () {
equals(render('format-literal', {}), '<div foo="bar"/>',
"Literal format");
equals(render('format-value', {value:'a'}), '<div foo="bar"/>',
"Valued format");
});
});
</script>