]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Increase coverage of JSX extraction tests 425/head
authorGeorg Schölly <git@gsch.ch>
Sat, 25 Jun 2016 10:59:00 +0000 (12:59 +0200)
committerAarni Koskela <akx@iki.fi>
Sat, 19 Nov 2016 14:06:16 +0000 (16:06 +0200)
b5e0ad8 fixed a few bugs with jsx parsing but only added
tests for the lexer. This commit adds a test for the extraction
which did not work before:

    <tag>{ _"Text" }</tag>

This test case is not present yet in the suite, only tags with
attributes (<tag attr="value">) are, but they get extracted correctly
already.

tests/messages/test_js_extract.py

index 35322ea16b622158a875bfaa4537f9a7b0c132fd..d19c255fbc8df79379b1a860bbc5e2b834d34b34 100644 (file)
@@ -108,10 +108,12 @@ class Foo {
             <option value="val1">{ i18n._('String1') }</option>
             <option value="val2">{ i18n._('String 2') }</option>
             <option value="val3">{ i18n._('String 3') }</option>
+            <option value="val4">{ _('String 4') }</option>
+            <option>{ _('String 5') }</option>
         );
     }
 """
-EXPECTED_JSX_MESSAGES = ["hello", "String1", "String 2", "String 3"]
+EXPECTED_JSX_MESSAGES = ["hello", "String1", "String 2", "String 3", "String 4", "String 5"]
 
 
 @pytest.mark.parametrize("jsx_enabled", (False, True))