Skip to content

Commit

Permalink
Add test that .js and .jsx files are parsed for javascript.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelzangl committed Apr 27, 2019
1 parent 6b5d4dc commit ba1cdfd
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions features/makepot.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1638,6 +1638,48 @@ Feature: Generate a POT file of a WordPress project
msgid "wrong-domain"
"""

Scenario: Parse .js and .jsx files for javascript translations
Given an empty foo-plugin directory
And a foo-plugin/foo-plugin.php file:
"""
<?php
/**
* Plugin Name: Foo Plugin
*/
"""
And a foo-plugin/foo-plugin.js file:
"""
__( 'js', 'foo-plugin' );
"""
And a foo-plugin/foo-plugin.jsx file:
"""
__( 'jsx', 'foo-plugin' );
"""
And a foo-plugin/foo-plugin.whatever file:
"""
__( 'whatever', 'foo-plugin' );
"""

When I try `wp i18n make-pot foo-plugin`
Then STDOUT should be:
"""
Plugin file detected.
Success: POT file successfully generated!
"""
And the foo-plugin/foo-plugin.pot file should exist
And the foo-plugin/foo-plugin.pot file should contain:
"""
msgid "js"
"""
And the foo-plugin/foo-plugin.pot file should contain:
"""
msgid "jsx"
"""
And the foo-plugin/foo-plugin.pot file should not contain:
"""
msgid "whatever"
"""

Scenario: Extract translator comments from JavaScript file
Given an empty foo-plugin directory
And a foo-plugin/foo-plugin.php file:
Expand Down

0 comments on commit ba1cdfd

Please sign in to comment.