Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 1x | /**
*
* Will return true or false whether or not an `<option>` or `<input>` element of type
* checkbox or radio is currently selected.
*
* <example>
:index.html
<select name="selectbox" id="selectbox">
<option value="John Doe">John Doe</option>
<option value="Layla Terry" selected="selected">Layla Terry</option>
<option value="Bill Gilbert">Bill Gilbert"</option>
</select>
:isSelected.js
it('should detect if an element is selected', () => {
let element = $('[value="Layla Terry"]');
console.log(element.isSelected()); // outputs: true
element = $('[value="Bill Gilbert"]')
console.log(element.isSelected()); // outputs: false
});
* </example>
*
* @alias element.isSelected
* @return {Boolean} true if element is selected
* @uses protocol/elements, protocol/elementIdSelected
* @type state
*
*/
export default function isSelected() {
return this.isElementSelected(this.elementId)
}
|