forked from primefaces/primefaces
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
161 additions
and
5 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
...n-tests/src/main/java/org/primefaces/integrationtests/commandbutton/CommandButton001.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,46 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2009-2023 PrimeTek Informatics | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package org.primefaces.integrationtests.commandbutton; | ||
|
||
import java.io.Serializable; | ||
|
||
import javax.faces.view.ViewScoped; | ||
import javax.inject.Named; | ||
|
||
import org.primefaces.integrationtests.general.utilities.TestUtils; | ||
|
||
import lombok.Data; | ||
|
||
@Named | ||
@ViewScoped | ||
@Data | ||
public class CommandButton001 implements Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public void submit() { | ||
TestUtils.addMessage("Submit"); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
primefaces-integration-tests/src/main/webapp/commandbutton/commandButton001.xhtml
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,23 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:h="http://xmlns.jcp.org/jsf/html" | ||
xmlns:f="http://xmlns.jcp.org/jsf/core" | ||
xmlns:p="http://primefaces.org/ui"> | ||
|
||
<f:view contentType="text/html;charset=UTF-8" encoding="UTF-8"> | ||
<h:head/> | ||
|
||
<h:body> | ||
<h:form id="form"> | ||
<h:panelGroup> | ||
Hello | ||
</h:panelGroup> | ||
|
||
<p:commandButton id="button" value="Submit" update="@previous" | ||
action="#{commandButton001.submit()}" | ||
disableOnAjax="true"/> | ||
</h:form> | ||
</h:body> | ||
</f:view> | ||
|
||
</html> |
79 changes: 79 additions & 0 deletions
79
...sts/src/test/java/org/primefaces/integrationtests/commandbutton/CommandButton001Test.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,79 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2009-2023 PrimeTek Informatics | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package org.primefaces.integrationtests.commandbutton; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Order; | ||
import org.junit.jupiter.api.Test; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.primefaces.selenium.AbstractPrimePage; | ||
import org.primefaces.selenium.AbstractPrimePageTest; | ||
import org.primefaces.selenium.PrimeSelenium; | ||
import org.primefaces.selenium.component.CommandButton; | ||
|
||
public class CommandButton001Test extends AbstractPrimePageTest { | ||
|
||
@Test | ||
@Order(1) | ||
@DisplayName("CommandButton: loading state") | ||
void loadingState(Page page) { | ||
// Arrange | ||
CommandButton button = page.button; | ||
setMinLoadAnim(100); | ||
|
||
// Act | ||
page.button.click(); | ||
|
||
// Assert | ||
assertTrue(PrimeSelenium.hasCssClass(button, "ui-state-loading")); | ||
} | ||
|
||
@Test | ||
@Order(2) | ||
@DisplayName("CommandButton: loading state 2") | ||
void loadingState2(Page page) { | ||
// Arrange | ||
CommandButton button = page.button; | ||
noMinLoadAnim(); | ||
|
||
// Act | ||
page.button.click(); | ||
|
||
// Assert | ||
assertFalse(PrimeSelenium.hasCssClass(button, "ui-state-loading")); | ||
} | ||
|
||
public static class Page extends AbstractPrimePage { | ||
@FindBy(id = "form:button") | ||
CommandButton button; | ||
|
||
@Override | ||
public String getLocation() { | ||
return "commandbutton/commandButton001.xhtml"; | ||
} | ||
} | ||
|
||
} |
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