[Zope-Checkins] CVS: Zope3/lib/python/Zope/TAL/tests - test_htmltalparser.py:1.31

Fred L. Drake, Jr. fdrake@acm.org
Mon, 17 Jun 2002 17:00:36 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/TAL/tests
In directory cvs.zope.org:/tmp/cvs-serv32223/tests

Modified Files:
	test_htmltalparser.py 
Log Message:
Implement lexical scoping of the translation context.

=== Zope3/lib/python/Zope/TAL/tests/test_htmltalparser.py 1.30 => 1.31 ===
         self._run_check("<span i18n:domain='mydomain'/>", [
             ('setPosition', (1, 0)),
-            ('beginI18nContext', {'domain': 'mydomain'}),
+            ('beginI18nContext', {'domain': 'mydomain',
+                                  'source': None, 'target': None}),
             ('beginScope', {'i18n:domain': 'mydomain'}),
             ('startEndTag', ('span', [('i18n:domain', 'mydomain', 'i18n')])),
             ('endScope', ()),
@@ -634,7 +635,8 @@
     def check_i18n_context_source(self):
         self._run_check("<span i18n:source='en'/>", [
             ('setPosition', (1, 0)),
-            ('beginI18nContext', {'source': 'en'}),
+            ('beginI18nContext', {'source': 'en',
+                                  'domain': 'default', 'target': None}),
             ('beginScope', {'i18n:source': 'en'}),
             ('startEndTag', ('span', [('i18n:source', 'en', 'i18n')])),
             ('endScope', ()),
@@ -644,12 +646,40 @@
     def check_i18n_context_source_target(self):
         self._run_check("<span i18n:source='en' i18n:target='ru'/>", [
             ('setPosition', (1, 0)),
-            ('beginI18nContext', {'source': 'en', 'target': 'ru'}),
+            ('beginI18nContext', {'source': 'en', 'target': 'ru',
+                                  'domain': 'default'}),
             ('beginScope', {'i18n:source': 'en', 'i18n:target': 'ru'}),
             ('startEndTag', ('span', [('i18n:source', 'en', 'i18n'),
                                       ('i18n:target', 'ru', 'i18n')])),
             ('endScope', ()),
             ('endI18nContext', ()),
+            ])
+
+    def check_i18n_context_in_define_slot(self):
+        text = ("<div metal:use-macro='M' i18n:domain='mydomain'>"
+                "<div metal:fill-slot='S'>spam</div>"
+                "</div>")
+        self._run_check(text, [
+            ('setPosition', (1, 0)),
+            ('useMacro',
+             ('M', '$M$',
+              {'S': [('startTag', ('div',
+                                   [('metal:fill-slot', 'S', 'metal')])),
+                     rawtext('spam</div>')]},
+              [('beginI18nContext', {'domain': 'mydomain',
+                                     'source': None, 'target': None}),
+               ('beginScope',
+                {'i18n:domain': 'mydomain', 'metal:use-macro': 'M'}),
+               ('startTag', ('div', [('metal:use-macro', 'M', 'metal'),
+                                     ('i18n:domain', 'mydomain', 'i18n')])),
+               ('setPosition', (1, 48)),
+               ('fillSlot', ('S',
+                             [('startTag',
+                               ('div', [('metal:fill-slot', 'S', 'metal')])),
+                              rawtext('spam</div>')])),
+               ('endScope', ()),
+               rawtext('</div>'),
+               ('endI18nContext', ())])),
             ])
 
     def check_i18n_data(self):