-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Accessibility roles are enums that are looked up by matching a string accessibility role from JS to the enum's name using .toUpperCase(). .toUpperCase() causes issues in certain languages such as Turkish because the "i"s translate to "?". D9402330 tried to address this by forcing the .toUpperCase to use Locale.US, but now it sometimes translates to "?" Use .equalsIgnoreCase() instead to avoid translations. Reviewed By: mdvacca, mmmulani Differential Revision: D9497494 fbshipit-source-id: 0f8b7f2071b08ccb86655fee7bfd2d009ddde8eb
- Loading branch information
1 parent
47dc31d
commit 1f96ff6
Showing
4 changed files
with
61 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
package com.facebook.react.uimanager; | ||
|
||
import static org.mockito.Mockito.mock; | ||
|
||
import android.content.Context; | ||
import android.support.v4.view.ViewCompat; | ||
import com.facebook.react.uimanager.AccessibilityDelegateUtil.AccessibilityRole; | ||
import com.facebook.react.views.view.ReactViewGroup; | ||
import com.facebook.react.views.view.ReactViewManager; | ||
import com.facebook.react.R; | ||
import java.util.Locale; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.robolectric.RuntimeEnvironment; | ||
import org.robolectric.RobolectricTestRunner; | ||
import static org.fest.assertions.api.Assertions.assertThat; | ||
|
||
@RunWith(RobolectricTestRunner.class) | ||
public class BaseViewManagerTest { | ||
|
||
private BaseViewManager mViewManager; | ||
private ReactViewGroup mView; | ||
|
||
@Before | ||
public void setUp() { | ||
mViewManager = new ReactViewManager(); | ||
mView = new ReactViewGroup(RuntimeEnvironment.application); | ||
} | ||
|
||
@Test | ||
public void testAccessibilityRoleNone() { | ||
mViewManager.setAccessibilityRole(mView, "none"); | ||
assertThat(mView.getTag(R.id.accessibility_role)).isEqualTo(AccessibilityRole.NONE); | ||
} | ||
|
||
@Test | ||
public void testAccessibilityRoleTurkish() { | ||
Locale.setDefault(Locale.forLanguageTag("tr-TR")); | ||
mViewManager.setAccessibilityRole(mView, "image"); | ||
assertThat(mView.getTag(R.id.accessibility_role)).isEqualTo(AccessibilityRole.IMAGE); | ||
} | ||
} |