diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php index 9906992..43182a5 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php @@ -130,4 +130,33 @@ function testEnabledTranslatableColumnManageFieldsTab() { } } + /** + * Tests translatable column on comment manage fields page for a field. + */ + function testEnabledFieldTranslatableColumnManageFieldsTab() { + + $this->admin_user = $this->drupalCreateUser(array('administer content types', 'access administration pages', 'access content overview', 'administer nodes', 'bypass node access')); + $this->drupalLogin($this->admin_user); + $this->drupalGet('admin/structure/types/manage/' . $this->nodeBundle . '/comment/fields'); + + $label = 'Yes'; + // Check that the field appears in the overview form. + $this->assertFieldByXPath('//tr[@id="field-test-et-ui-test"]/td[7]', $label, 'Translation is enabled on field'); + $this->assertFieldByXPath('//tr[@id="field-test-et-ui-test"]/td[7]/span[@class="element-invisible"]', 'Translatable', 'Translation is enabled on field. Invisible element exists'); + } + + /** + * Tests translatable column on comment manage fields page for a disabled field. + */ + function testDisabledFieldTranslatableColumnManageFieldsTab() { + + $this->admin_user = $this->drupalCreateUser(array('administer content types', 'access administration pages', 'access content overview', 'administer nodes', 'bypass node access')); + $this->drupalLogin($this->admin_user); + $this->drupalGet('admin/structure/types/manage/' . $this->nodeBundle . '/comment/fields'); + + // Check that the field appears in the overview form. + $this->assertFieldByXPath('//tr[@id="field-test-et-ui-test-disabled"]/td[7]', '', 'Translation is disabled on field'); + $this->assertFieldByXPath('//tr[@id="field-test-et-ui-test-disabled"]/td[7]/span[@class="element-invisible"]', 'Not translatable', 'Translation is disabled on field. Invisible element exists'); + } + } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php index 87603a2..ba9d88b 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php @@ -120,4 +120,33 @@ function testEnabledTranslatableColumnManageFieldsTab() { $this->assertRaw($table_header . '', format_string('%table_header table header was found.', array('%table_header' => $table_header))); } } + + /** + * Tests translatable column on content-type manage fields page for a field. + */ + function testEnabledFieldTranslatableColumnManageFieldsTab() { + + $this->admin_user = $this->drupalCreateUser(array('administer content types', 'access administration pages', 'access content overview', 'administer nodes', 'bypass node access')); + $this->drupalLogin($this->admin_user); + $this->drupalGet('admin/structure/types/manage/' . $this->bundle . '/fields'); + + $label = 'Yes'; + // Check that the field appears in the overview form. + $this->assertFieldByXPath('//tr[@id="field-test-et-ui-test"]/td[7]', $label, 'Translation is enabled on field'); + $this->assertFieldByXPath('//tr[@id="field-test-et-ui-test"]/td[7]/span[@class="element-invisible"]', 'Translatable', 'Translation is enabled on field. Invisible element exists'); + } + + /** + * Tests translatable column on content-type manage fields page for a disabled field. + */ + function testDisabledFieldTranslatableColumnManageFieldsTab() { + + $this->admin_user = $this->drupalCreateUser(array('administer content types', 'access administration pages', 'access content overview', 'administer nodes', 'bypass node access')); + $this->drupalLogin($this->admin_user); + $this->drupalGet('admin/structure/types/manage/' . $this->bundle . '/fields'); + + // Check that the field appears in the overview form. + $this->assertFieldByXPath('//tr[@id="field-test-et-ui-test-disabled"]/td[7]', '', 'Translation is disabled on field'); + $this->assertFieldByXPath('//tr[@id="field-test-et-ui-test-disabled"]/td[7]/span[@class="element-invisible"]', 'Not translatable', 'Translation is disabled on field. Invisible element exists'); + } } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php index c575756..d6c3829 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php @@ -157,4 +157,33 @@ function testEnabledTranslatableColumnManageFieldsTab() { } } + /** + * Tests translatable column on taxonomy Manage fields page for a field. + */ + function testEnabledFieldTranslatableColumnManageFieldsTab() { + + $this->admin_user = $this->drupalCreateUser(array('administer taxonomy', 'access administration pages', 'administer nodes')); + $this->drupalLogin($this->admin_user); + $this->drupalGet('admin/structure/taxonomy/' . $this->bundle . '/fields'); + + $label = 'Yes'; + // Check that the field appears in the overview form. + $this->assertFieldByXPath('//tr[@id="field-test-et-ui-test"]/td[7]', $label, 'Translation is enabled on field'); + $this->assertFieldByXPath('//tr[@id="field-test-et-ui-test"]/td[7]/span[@class="element-invisible"]', 'Translatable', 'Translation is enabled on field. Invisible element exists'); + } + + /** + * Tests translatable column on taxonomy Manage fields page for a disabled field. + */ + function testDisabledFieldTranslatableColumnManageFieldsTab() { + + $this->admin_user = $this->drupalCreateUser(array('administer taxonomy', 'access administration pages', 'administer nodes')); + $this->drupalLogin($this->admin_user); + $this->drupalGet('admin/structure/taxonomy/' . $this->bundle . '/fields'); + + // Check that the field appears in the overview form. + $this->assertFieldByXPath('//tr[@id="field-test-et-ui-test-disabled"]/td[7]', '', 'Translation is disabled on field'); + $this->assertFieldByXPath('//tr[@id="field-test-et-ui-test-disabled"]/td[7]/span[@class="element-invisible"]', 'Not translatable', 'Translation is disabled on field. Invisible element exists'); + } + } diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php index 934ed62..d936e5f 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php @@ -138,6 +138,29 @@ protected function setupTestFields() { ), ); field_create_instance($instance); + + + $this->disabled_fieldName = 'field_test_et_ui_test_disabled'; + + $disabled_field = array( + 'field_name' => $this->disabled_fieldName, + 'type' => 'text', + 'cardinality' => 1, + 'translatable' => FALSE, + ); + field_create_field($disabled_field); + + $disabled_instance = array( + 'entity_type' => $this->entityType, + 'field_name' => $this->disabled_fieldName, + 'bundle' => $this->bundle, + 'label' => 'Test disabled text-field', + 'widget' => array( + 'type' => 'text_textfield', + 'weight' => 0, + ), + ); + field_create_instance($disabled_instance); } /** diff --git a/core/modules/user/lib/Drupal/user/Tests/UserTranslationUITest.php b/core/modules/user/lib/Drupal/user/Tests/UserTranslationUITest.php index 39b5b5d..b7ebd25 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserTranslationUITest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserTranslationUITest.php @@ -91,4 +91,33 @@ function testEnabledTranslatableColumnManageFieldsTab() { $this->assertRaw($table_header . '', format_string('%table_header table header was found.', array('%table_header' => $table_header))); } } + + /** + * Tests translatable column on account fields page. + */ + function testEnabledFieldTranslatableColumnManageFieldsTab() { + + $this->admin_user = $this->drupalCreateUser(array('access administration pages', 'administer users')); + $this->drupalLogin($this->admin_user); + $this->drupalGet('admin/config/people/accounts/fields'); + + $label = 'Yes'; + // Check that the field appears in the overview form. + $this->assertFieldByXPath('//tr[@id="field-test-et-ui-test"]/td[7]', $label, 'Translation is enabled on field'); + $this->assertFieldByXPath('//tr[@id="field-test-et-ui-test"]/td[7]/span[@class="element-invisible"]', 'Translatable', 'Translation is enabled on field. Invisible element exists'); + } + + /** + * Tests translatable column on account fields page for disabled field. + */ + function testDisabledFieldTranslatableColumnManageFieldsTab() { + + $this->admin_user = $this->drupalCreateUser(array('access administration pages', 'administer users')); + $this->drupalLogin($this->admin_user); + $this->drupalGet('admin/config/people/accounts/fields'); + + // Check that the field appears in the overview form. + $this->assertFieldByXPath('//tr[@id="field-test-et-ui-test-disabled"]/td[7]', '', 'Translation is disabled on field'); + $this->assertFieldByXPath('//tr[@id="field-test-et-ui-test-disabled"]/td[7]/span[@class="element-invisible"]', 'Not translatable', 'Translation is disabled on field. Invisible element exists'); + } }