[FIX] QWeb foreach tests for qweb2 compat (no t-trim)
bzr revid: xmo@openerp.com-20110504100908-1ip2sjo32yyp786d
This commit is contained in:
@@ -1,40 +1,17 @@
|
||||
<templates>
|
||||
<t t-name="repetition-text-content" t-trim="both">
|
||||
<t t-foreach="seq">*</t>
|
||||
</t>
|
||||
<t t-name="repetition-dom-content" t-trim="both">
|
||||
<t t-foreach="seq"><b/></t>
|
||||
</t>
|
||||
<t t-name="repetition-self" t-trim="both">
|
||||
<b t-foreach="seq"/>
|
||||
</t>
|
||||
<t t-name="repetition-text-content" t-foreach="seq">*</t>
|
||||
<t t-name="repetition-dom-content" t-foreach="seq"><b/></t>
|
||||
<b t-name="repetition-self" t-foreach="seq"/>
|
||||
|
||||
<t t-name="scope-self" t-trim="both">
|
||||
<t t-foreach="seq"><t t-esc="seq"/></t>
|
||||
</t>
|
||||
<t t-name="scope-value" t-trim="both">
|
||||
<t t-foreach="seq"><t t-esc="seq_value"/></t>
|
||||
</t>
|
||||
<t t-name="scope-index" t-trim="both">
|
||||
<t t-foreach="seq"><t t-esc="seq_index"/></t>
|
||||
</t>
|
||||
<t t-name="scope-first" t-trim="both">
|
||||
<t t-foreach="seq"><t t-esc="seq_first"/> </t>
|
||||
</t>
|
||||
<t t-name="scope-last" t-trim="both">
|
||||
<t t-foreach="seq"><t t-esc="seq_last"/> </t>
|
||||
</t>
|
||||
<t t-name="scope-parity" t-trim="both">
|
||||
<t t-foreach="seq"><t t-esc="seq_parity"/> </t>
|
||||
</t>
|
||||
<t t-name="scope-size" t-trim="both">
|
||||
<t t-foreach="seq"><t t-esc="seq_size"/> </t>
|
||||
</t>
|
||||
<t t-name="scope-self" t-foreach="seq" t-esc="seq"/>
|
||||
<t t-name="scope-value" t-foreach="seq" t-esc="seq_value"/>
|
||||
<t t-name="scope-index" t-foreach="seq" t-esc="seq_index"/>
|
||||
<t t-name="scope-first" t-foreach="seq"><t t-esc="seq_first"/> </t>
|
||||
<t t-name="scope-last" t-foreach="seq"><t t-esc="seq_last"/> </t>
|
||||
<t t-name="scope-parity" t-foreach="seq"><t t-esc="seq_parity"/> </t>
|
||||
<t t-name="scope-size" t-foreach="seq"><t t-esc="seq_size"/> </t>
|
||||
|
||||
<t t-name="aliasing" t-trim="both">
|
||||
<t t-foreach="seq" t-as="item"><t t-esc="item"/></t>
|
||||
</t>
|
||||
<t t-name="loopvars-aliasing" t-trim="both">
|
||||
<t t-foreach="seq" t-as="item"><t t-esc="item_parity"/> </t>
|
||||
</t>
|
||||
<t t-name="aliasing" t-foreach="seq" t-as="item" t-esc="item"/>
|
||||
<t t-name="loopvars-aliasing"
|
||||
t-foreach="seq" t-as="item"><t t-esc="item_parity"/> </t>
|
||||
</templates>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen"/>
|
||||
<script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script>
|
||||
|
||||
<script type="text/javascript" src="qweb.js"></script>
|
||||
<script type="text/javascript" src="qweb2.js"></script>
|
||||
|
||||
<script>
|
||||
function trim(s) {
|
||||
@@ -252,19 +252,19 @@
|
||||
"each value of the sequence is also via the _value");
|
||||
equals(QWeb.render('scope-index', {seq:seq}), '01234',
|
||||
"the current 0-based index is available via _index");
|
||||
equals(QWeb.render('scope-first', {seq:seq}), 'true false false false false',
|
||||
equals(QWeb.render('scope-first', {seq:seq}), 'true false false false false ',
|
||||
"_first says whether the current item is the first of the sequence");
|
||||
equals(QWeb.render('scope-last', {seq:seq}), 'false false false false true',
|
||||
equals(QWeb.render('scope-last', {seq:seq}), 'false false false false true ',
|
||||
"_last says whether the current item is the last of the sequence");
|
||||
equals(QWeb.render('scope-parity', {seq:seq}), 'even odd even odd even',
|
||||
equals(QWeb.render('scope-parity', {seq:seq}), 'even odd even odd even ',
|
||||
"the parity (odd/even) of the current row is available via _parity");
|
||||
equals(QWeb.render('scope-size', {seq:seq}), '5 5 5 5 5',
|
||||
equals(QWeb.render('scope-size', {seq:seq}), '5 5 5 5 5 ',
|
||||
"the total length of the sequence is available through _size");
|
||||
});
|
||||
test('Name aliasing via t-as', function () {
|
||||
equals(QWeb.render('aliasing', {seq:seq}), '43210',
|
||||
"the inner value can be re-bound via t-as");
|
||||
equals(QWeb.render('loopvars-aliasing', {seq:seq}), 'even odd even odd even',
|
||||
equals(QWeb.render('loopvars-aliasing', {seq:seq}), 'even odd even odd even ',
|
||||
"inner loop variables should be rebound as well");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user