View Javadoc
1   /*
2    * Copyright (c) 2002-2025 Gargoyle Software Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * https://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package org.htmlunit.libraries.htmx;
16  
17  import org.htmlunit.WebClient;
18  import org.htmlunit.javascript.preprocessor.HtmxTwoZeroSevenScriptPreProcessor;
19  import org.htmlunit.junit.annotation.Alerts;
20  import org.htmlunit.junit.annotation.HtmlUnitNYI;
21  import org.junit.jupiter.api.Test;
22  
23  /**
24   * Tests for <a href="https://htmx.org/">htmx</a>.
25   *
26   * @author Ronald Brill
27   */
28  public class HtmxTest2x0x7 extends HtmxTest {
29  
30      /**
31       * @throws Exception if an error occurs
32       */
33      @Test
34      @Alerts(DEFAULT = "passes:739failures:1",
35              FF = "passes:734failures:2",
36              FF_ESR = "passes:734failures:2")
37      @HtmlUnitNYI(
38              CHROME = "passes:724failures:17",
39              EDGE = "passes:724failures:17",
40              FF = "passes:723failures:15",
41              FF_ESR = "passes:723failures:15")
42      public void htmx() throws Exception {
43          htmx("htmx-2.0.7", false);
44      }
45  
46      /**
47       * @throws Exception if an error occurs
48       */
49      @Test
50      @Alerts(DEFAULT = "passes:636failures:104",
51              FF = "passes:637failures:99",
52              FF_ESR = "passes:637failures:99")
53      @HtmlUnitNYI(
54              CHROME = "passes:623failures:116",
55              EDGE = "passes:623failures:116",
56              FF = "passes:628failures:108",
57              FF_ESR = "passes:628failures:108")
58      public void htmxMin() throws Exception {
59          htmx("htmx-2.0.7", true);
60      }
61  
62      @Override
63      protected void setupWebClient(final WebClient webClient) {
64          super.setupWebClient(webClient);
65  
66          webClient.setScriptPreProcessor(new HtmxTwoZeroSevenScriptPreProcessor());
67          webClient.getOptions().setThrowExceptionOnScriptError(false);
68      }
69  }