[TEST] attribute-addition features
bzr revid: xmo@openerp.com-20110310121827-im1lnvwor0x97ear
This commit is contained in:
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user