Пример #1
0
  @Test
  public void testShouldCreateLocaleListBoxContainingAllLanguageOptions() {
    // given
    LocaleSelector selector = IOC.getBeanManager().lookupBean(LocaleSelector.class).getInstance();
    LocaleListBox localeListBox = app.getComponent().getListBox();
    localeListBox.init();

    // when - then
    assertNull(localeListBox.getValue());
    assertEquals(4, selector.getSupportedLocales().size());

    localeListBox.setValue(new Locale("da", "Danish"), true);

    assertEquals("da", TranslationService.currentLocale());
    assertNotNull(localeListBox.getValue());
  }
Пример #2
0
  /** Tests that the bundle is created and is accessible. */
  @Test
  public void testBundleAccess() {
    assertNotNull(app.getComponent());
    assertEquals(
        "Welcome to the errai-ui i18n demo.", app.getComponent().getWelcome_p().getInnerText());
    assertEquals("Label 1:", app.getComponent().getLabel1().getText());
    assertEquals("value one", app.getComponent().getVal1().getText());
    assertEquals("Label 1.1:", app.getComponent().getNestedLabel().getText());
    assertEquals("value one.one", app.getComponent().getVal1_1().getText());
    assertEquals("Label 2:", app.getComponent().getLabel2().getText());
    assertEquals("value two", app.getComponent().getVal2().getText());
    assertEquals(
        "This is a really really really really really really really really really"
            + " really really really really really really really really really really really"
            + " long string that exceeds the cutoff length for adding a hash to its internationalization key.",
        app.getComponent().getLongTextLabel().getText());

    assertEquals("Email:", app.getComponent().getEmailLabel().getText());
    assertEquals(
        "Enter your email address...",
        app.getComponent().getEmail().getElement().getAttribute("placeholder"));
    assertEquals("Password:"******"Your password goes here.",
        app.getComponent().getPassword().getElement().getAttribute("title"));
  }