コード例 #1
0
  @Test
  public void testActiveClass() {
    String testedClass = "metamer-ftest-class";
    inplaceInputAttributes.set(InplaceInputAttributes.activeClass, testedClass);

    assertFalse(
        Graphene.attribute(inplaceInput.getRoot(), "class")
            .valueContains(testedClass)
            .apply(driver),
        "Inplace input should not have class metamer-ftest-class.");

    EditingState editingState = inplaceInput.editBy(OpenBy.CLICK);
    assertTrue(
        Graphene.attribute(inplaceInput.getRoot(), "class")
            .valueContains(testedClass)
            .apply(driver),
        "Inplace input should have class metamer-ftest-class.");

    editingState.cancel();

    assertFalse(
        Graphene.attribute(inplaceInput.getRoot(), "class")
            .valueContains(testedClass)
            .apply(driver),
        "Inplace input should not have class metamer-ftest-class.");
  }
コード例 #2
0
  @Test
  public void testClick() {
    EditingState editingState =
        MetamerPage.waitRequest(inplaceInput, WaitRequestType.NONE).editBy(OpenBy.CLICK);
    assertTrue(inplaceInput.is(State.ACTIVE), "Input should be active.");

    String testedValue = "new value";
    MetamerPage.waitRequest(editingState.type(testedValue), WaitRequestType.XHR).confirm();

    assertTrue(inplaceInput.is(State.CHANGED), "Input should contain class indicating a change.");
    assertEquals(inplaceInput.getLabelValue(), testedValue, "Input should contain typed text.");

    page.assertListener(
        PhaseId.PROCESS_VALIDATIONS, "value changed: RichFaces 4 -> " + testedValue);
    page.assertPhases(
        PhaseId.RESTORE_VIEW,
        PhaseId.APPLY_REQUEST_VALUES,
        PhaseId.PROCESS_VALIDATIONS,
        PhaseId.UPDATE_MODEL_VALUES,
        PhaseId.INVOKE_APPLICATION,
        PhaseId.RENDER_RESPONSE);
  }