Skip to content

Commit

Permalink
Fix code example display in expect API Overview page.
Browse files Browse the repository at this point in the history
  • Loading branch information
garg3133 committed Nov 12, 2024
1 parent ad88769 commit 28388e2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions docs/api/expect/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ also adding new capabilities over the classic `assert` interface.

It uses a chain-able language to construct assertions given an element specified by a css/xpath selector. A simple example looks like the following:

```javascript
describe('expect example', function() {
<div class="sample-test">
<pre class="line-numbers" data-language="javascript"><code class="language-javascript">describe('expect example', function() {
it('sample test', function (browser) {
// start with identifying the element
// and then assert the element is present
Expand All @@ -18,7 +18,8 @@ describe('expect example', function() {
browser.expect.element('#main').to.be.visible;
});
}
```
</code></pre>
</div>

<h3 id="expect-chains">Language Chains</h3>

Expand All @@ -43,13 +44,14 @@ The following are provided as chainable getters to improve the readability of yo

These methods will perform assertions on the specified target on the current element. The targets can be an attribute value, the element's inner text and a css property.

```javascript
this.demoTest = function (browser) {
<div class="sample-test">
<pre class="line-numbers" data-language="javascript"><code class="language-javascript">this.demoTest = function (browser) {
browser.expect.element('#main').text.to.equal('The Night Watch');
browser.expect.element('#main').text.to.contain('The Night Watch');
browser.expect.element('#main').to.have.css('display').which.equals('block');
};
```
</code></pre>
</div>

<div class="apimethod">
<h3 id="expect-startend">.startWith(<code>value</code>)/.endWith(<code>value</code>)</h3>
Expand Down

0 comments on commit 28388e2

Please sign in to comment.