package com.atlassian.webdriver.bitbucket.element;

import com.atlassian.pageobjects.elements.PageElement;
import com.atlassian.pageobjects.elements.WebDriverLocatable;
import com.atlassian.pageobjects.elements.timeout.TimeoutType;
import org.openqa.selenium.By;

/**
 * Models the spinner for spin.js
 */
public class JsSpinner extends LegacyElementPageObject implements Spinner {

    public JsSpinner(PageElement pageElement) {
        super(pageElement);
    }

    public JsSpinner(By locator) {
        super(locator, TimeoutType.DEFAULT);
    }

    public JsSpinner(WebDriverLocatable locatable, TimeoutType timeoutType) {
        super(locatable, timeoutType);
    }

    public JsSpinner(By locator, WebDriverLocatable parent) {
        super(locator, parent);
    }

    public JsSpinner(By locator, WebDriverLocatable parent, TimeoutType timeoutType) {
        super(locator, parent, timeoutType);
    }

    public JsSpinner(By locator, TimeoutType timeoutType) {
        super(locator, timeoutType);
    }

    @Override
    public boolean isSpinning() {
        return this.findAll(By.className(".spinner")).size() != 0;
    }
}
