|
| 1 | +/* |
| 2 | + * Copyright (c) 2016 seleniumQuery authors |
| 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 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package endtoend.selectors.pseudoclasses.form; |
| 18 | + |
| 19 | +import org.junit.ClassRule; |
| 20 | +import org.junit.Rule; |
| 21 | +import org.junit.Test; |
| 22 | +import testinfrastructure.SecondGenSelectorSystemDetector; |
| 23 | +import testinfrastructure.junitrule.SetUpAndTearDownDriver; |
| 24 | + |
| 25 | +import static io.github.seleniumquery.SeleniumQuery.$; |
| 26 | +import static org.hamcrest.Matchers.is; |
| 27 | +import static org.junit.Assert.assertThat; |
| 28 | + |
| 29 | +public class CheckedPseudoClassWithChangeTest { |
| 30 | + |
| 31 | + @ClassRule @Rule public static SetUpAndTearDownDriver setUpAndTearDownDriverRule = new SetUpAndTearDownDriver(); |
| 32 | + |
| 33 | + @Test |
| 34 | + public void checkedPseudoClass__when_selected_changes() { |
| 35 | + SecondGenSelectorSystemDetector.assumeSecondGenSelectorSystem(); |
| 36 | + assertThat($(":checked").size(), is(1)); |
| 37 | + assertThat($(":checked").attr("id"), is("b")); |
| 38 | + |
| 39 | + assertThat($("[selected]").size(), is(1)); |
| 40 | + assertThat($("[selected]").attr("id"), is("b")); |
| 41 | + |
| 42 | + $("#c").prop("selected", true); |
| 43 | + |
| 44 | + assertThat($(":checked").size(), is(1)); |
| 45 | + assertThat($(":checked").attr("id"), is("c")); |
| 46 | + |
| 47 | + assertThat($("[selected]").size(), is(1)); |
| 48 | + assertThat($("[selected]").attr("id"), is("b")); |
| 49 | + } |
| 50 | + |
| 51 | +} |
0 commit comments