Skip to content

Commit

Permalink
initial snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
jclausen committed Nov 27, 2024
1 parent 488181c commit 1ae4a3f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 41 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ jobs:
distribution: "temurin"
java-version: 21

- uses: Ortus-Solutions/commandbox-action@v1.0.2
with:
cmd: run-script format:check
# - uses: Ortus-Solutions/commandbox-action@v1.0.2
# with:
# cmd: run-script format:check

- name: Verify Code Formatting
run: ./gradlew spotlessCheck
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ public void testFormComponentInCF() {
);
// @formatter:on
String output = variables.getAsString( result );
System.out.println( "------------------------------------" );
System.out.println( output );
System.out.println( "------------------------------------" );
assertTrue( output.contains( "<form" ) );
assertTrue( output.contains( "</form>" ) );
assertTrue( output.contains( "action=\"index.cfm\" method=\"post\"" ) );
Expand All @@ -47,34 +44,35 @@ public void testFormComponentInCF() {
assertTrue( output.contains( "<textarea name=\"textarea\">Blah</textarea>" ) );
}

// @DisplayName( "It can test the FormComponent with basic inputs in BL components" )
// @Test
// public void testFormComponentInBL() {
// // @formatter:off
// runtime.executeSource( """
// <bx:form action="index.cfm" method="post">
// <bx:input type="text" name="name" />
// <bx:input name="submit" type="submit" value="Submit" />
// </bx:form>
// <bx:set result = getBoxContext().getBuffer().toString()/ >
// """,
// context,
// BoxSourceType.BOXTEMPLATE
// );
// // @formatter:on

// String output = variables.getAsString( result );
// System.out.println( "------------------------------------" );
// System.out.println( output );
// System.out.println( "------------------------------------" );
// System.out.println( "action=\"index.cfm\" method=\"post\"" );
// assertTrue( output.contains( "<form" ) );
// assertTrue( output.contains( "</form>" ) );
// assertTrue( output.contains( "action=\"index.cfm\" method=\"post\"" ) );
// assertTrue( output.contains( "type=\"text\" name=\"name\"" ) );
// assertTrue( output.contains( "type=\"text\" name=\"name\"" ) );
// }

@DisplayName( "It can test the FormComponent with basic inputs in BL components" )
@Test
public void testFormComponentInBL() {
// @formatter:off
runtime.executeSource( """
<bx:form action="index.cfm" method="post">
<bx:input type="text" name="name" />
<bx:select name="select" id="mySelect">
<option value="1">One</option>
<option value="2">Two</option>
</bx:select>
<bx:textarea name="textarea">Blah</bx:textarea>
<bx:slider name="slider" min="0" max="10" />
<bx:input name="submit" type="submit" value="Submit" />
</bx:form>
<bx:set result = getBoxContext().getBuffer().toString()>
""",
context,
BoxSourceType.BOXTEMPLATE
);
// @formatter:on
String output = variables.getAsString( result );
assertTrue( output.contains( "<form" ) );
assertTrue( output.contains( "</form>" ) );
assertTrue( output.contains( "action=\"index.cfm\" method=\"post\"" ) );
assertTrue( output.contains( "type=\"text\" name=\"name\"" ) );
assertTrue( output.contains( "type=\"text\" name=\"name\"" ) );
assertTrue( output.contains( "<textarea name=\"textarea\">Blah</textarea>" ) );
}

@DisplayName( "It can test the Select component with a query binding" )
@Test
Expand All @@ -99,16 +97,12 @@ public void testSelectComponentQuery() {
);
// @formatter:on
String output = variables.getAsString( result );
System.out.println( "------------------------------------" );
System.out.println( output );
System.out.println( "------------------------------------" );
assertTrue( output.contains( "<form" ) );
assertTrue( output.contains( "</form>" ) );
assertTrue( output.contains( "action=\"index.cfm\" method=\"post\"" ) );
assertTrue( output.contains( "<option value=\"MI\" selected>Michigan</option>" ) );
}


@DisplayName( "It can test the Select component with a grouped binding" )
@Test
public void testSelectComponentQueryGroup() {
Expand All @@ -133,9 +127,6 @@ public void testSelectComponentQueryGroup() {
);
// @formatter:on
String output = variables.getAsString( result );
System.out.println( "------------------------------------" );
System.out.println( output );
System.out.println( "------------------------------------" );
assertTrue( output.contains( "<form" ) );
assertTrue( output.contains( "</form>" ) );
assertTrue( output.contains( "action=\"index.cfm\" method=\"post\"" ) );
Expand Down

0 comments on commit 1ae4a3f

Please sign in to comment.