/**
 * This export default class requires the module {@link module./component}.
 * @requires ./component
 */
import Component from './component.js'

/**
 * Create component with selector 'a'.
 */

export default class AComponent extends Component {

    /**
     * Constructor.
     * @param {string| Component object } parent - Expects parent
     * @param {string} selector - optional parameter for selector
     */
    constructor(parent, selector) {
        if (selector) {
            super(parent, selector);
        } else {
            super(parent, 'a');
        }
    }

    /**
     * Method to get href attribute value.
     * @async
     * @method href
     * @return {Promise<string>} Returns value of href attribute
     */
    async href() {
        return await (await this.element()).getAttribute('href');
    }
}
