package com.sdl.selenium.web.form;

import com.sdl.selenium.web.WebLocator;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

public class CheckBoxTest {
    private static WebLocator container = new WebLocator("container");

    @DataProvider
    public static Object[][] testConstructorPathDataProvider() {
        return new Object[][]{
                {new CheckBox(),           "//input[@type='checkbox']"},
                {new CheckBox(container),  "//*[contains(concat(' ', @class, ' '), ' container ')]//input[@type='checkbox']"},
                {new CheckBox("Id"), "//input[@id='Id' and @type='checkbox']"},
                {new CheckBox("Id").setType("check"), "//input[@id='Id' and @type='check']"}
        };
    }

    @Test(dataProvider = "testConstructorPathDataProvider")
    public void getPathSelectorCorrectlyFromConstructors(CheckBox combo, String expectedXpath) {
        Assert.assertEquals(combo.getXPath(), expectedXpath);
    }
}

@@ -29,16 +29,56 @@
 .form;%0A%0A
+import com.sdl.selenium.web.SearchType;%0A
 import c
@@ -802,16 +802,337 @@
 heck'%5D%22%7D
+,%0A                %7Bnew CheckBox(container).setTag(%22span%22).setLabel(%22No Limit%22, SearchType.DEEP_CHILD_NODE_OR_SELF, SearchType.CONTAINS), %22//*%5Bcontains(concat(' ', @class, ' '), ' container ')%5D//label%5B(contains(.,'No Limit') or count(*//text()%5Bcontains(.,'No Limit')%5D) %3E 0)%5D//following-sibling::*//span%5B@type='checkbox'%5D%22%7D
 %0A       

add test