Skip to content

Commit

Permalink
Fixed checking font-weight returned an object, fixes #144
Browse files Browse the repository at this point in the history
  • Loading branch information
W. van Kuipers committed Oct 31, 2017
1 parent df8ad2c commit 151cb2f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion demo-app/index.html
Expand Up @@ -69,7 +69,7 @@ <h1>DEMO APP</h1>
<hr />

<div id="attributeComparison" role="note">This element has a role attribute with the value "note"</div>
<div id="cssAttributeComparison" style="color:rgba(255,0,0,1)">This element has a color css attribute with the value "rgba(255,0,0,1)"</div>
<div id="cssAttributeComparison" style="color:rgba(255,0,0,1); font-weight: 700">This element has a color css attribute with the value "rgba(255,0,0,1)"</div>

<hr />

Expand Down
3 changes: 3 additions & 0 deletions src/features/attribute.feature
Expand Up @@ -19,3 +19,6 @@ Feature: Test the attributes of a given element

Scenario: The (missing) CSS attribute "border" of a element should not be "0"
Then I expect that the css attribute "border" from element "#cssAttributeComparison" is not "0"

Scenario: The CSS attribute "font-weight" of a element should be "bold"
Then I expect that the css attribute "font-weight" from element "#cssAttributeComparison" is "bold"
4 changes: 2 additions & 2 deletions src/support/check/checkProperty.js
Expand Up @@ -28,10 +28,10 @@ module.exports = (isCSS, attrName, elem, falseCase, expectedValue) => {
let attributeValue = browser[command](elem, attrName);

/**
* when getting something with a color WebdriverIO returns a color
* when getting something with a color or font-weight WebdriverIO returns a
* object but we want to assert against a string
*/
if (attrName.indexOf('color') > -1) {
if (attrName.match(/(color|font-weight)/)) {
attributeValue = attributeValue.value;
}

Expand Down

0 comments on commit 151cb2f

Please sign in to comment.