How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • function () {
    
                
    
                //...
    if (isValid === true) {
    
                    
    
                    //...
    } else {
    
                    
    
                    //...
    if ($firstError.length) {
                        $('html, body').animate({
                            scrollTop: ($firstError.offset().top - 80)
                        }, 1000);
                    } else {
                        Raven.captureMessage('Model is not valid, but no elements was marked as error.');
                    }
                }
    
                
    
                //...
    }
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>local <span class="token keyword">var</span><span class="token punctuation">)</span> isValid<span class="token operator">:</span> <span class="token builtin">any</span></code></pre>
    /Turistforeningen/Turadmin mit
    0
  • function zoomTo( id ) {
        
        //...
    var offset;
    
        if (elHeight < windowHeight) {
    	offset = elOffset - ((windowHeight / 2) - (elHeight / 2));
        }
        else {
    	offset = elOffset;
        }
    
        $('html, body').animate({
    	scrollTop: offset
        }, 1000);
    }
    
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">function</span> <span class="token function">zoomTo</span><span class="token punctuation">(</span><span class="token parameter">id<span class="token operator">:</span> any</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token keyword">void</span></code></pre>
    /XimeraProject/server GPL-2.0
    0
  • function () {
    
                
    
                //...
    if (isValid === true) {
    
                    
    
                    //...
    } else {
    
                    
    
                    //...
    var $firstError = $('.has-error').first();
    
                    $('html, body').animate({
                        scrollTop: ($firstError.offset().top - 80)
                    }, 1000);
                }
    
                
    
                //...
    }
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>local <span class="token keyword">var</span><span class="token punctuation">)</span> isValid<span class="token operator">:</span> <span class="token builtin">any</span></code></pre>
    /Turistforeningen/Turadmin mit
    0
  • await render(AppComponent, {detectChanges: false})
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token builtin">any</span></code></pre>
    Docs
    0
  • const {fixture} = await render(AppComponent)
    
    const componentInstance = fixture.componentInstance as AppComponent
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">const</span> fixture<span class="token operator">:</span> <span class="token builtin">any</span></code></pre>
    Docs
    0
  • await render(AppComponent, {
      declarations: [ChildComponent],
      routes: [
        {
          path: '',
          children: [
            {
              path: 'child/:id',
              component: ChildComponent,
            },
          ],
        },
      ],
    })
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token builtin">any</span></code></pre>
    Docs
    0
  • await render(SpoilerDirective, {
      template: `<div spoiler message='SPOILER'></div>`,
    })
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token builtin">any</span></code></pre>
    Docs
    0
  • await render(AppComponent, {
      declarations: [CustomerDetailComponent, ButtonComponent],
    })
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token builtin">any</span></code></pre>
    Docs
    0
  • const {debug} = await render(AppComponent)
    
    debug()
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">const</span> debug<span class="token operator">:</span> <span class="token builtin">any</span></code></pre>
    Docs
    0
  • import {configure, screen} from '@testing-library/testcafe'
    
    fixture`configure`.clientScripts(
      configure({testIdAttribute: 'data-automation-id'}),
    ).page`http://localhost:13370`
    
    test('supports alternative testIdAttribute', async t => {
      await t.click(screen.getByTestId('image-with-random-alt-tag'))
    })
    
    test('still works after browser page load and reload', async t => {
      await t.click(screen.getByText('Go to Page 2'))
    
      await t.eval(() => location.reload(true))
    
      await t
        .click(screen.getByTestId('page2-thing'))
        .expect(screen.getByText('second page').exists)
        .ok()
    })
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">configure</span><span class="token punctuation">(</span><span class="token parameter">options<span class="token operator">:</span> Partial<span class="token operator">&lt;</span>Options<span class="token operator">></span></span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token punctuation">{</span> content<span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> <span class="token punctuation">}</span> <span class="token keyword">import</span> configure</code></pre>
    Docs
    0
  • import {within, screen} from '@testing-library/testcafe'
    
    fixture`within`.page`http://localhost:13370`
    
    test('works with getBy* selectors', async t => {
      await t
        .expect(
          within(screen.getByTestId('nested')).getByText('Button Text').exists,
        )
        .ok()
    })
    
    test('works with CSS selector strings', async t => {
      const {getByText} = await within('#nested')
      await t.click(getByText('Button Text')).ok()
    })
    
    test('works on any testcafe selector', async t => {
      const nested = Selector('#nested')
    
      await t.expect(within(nested).getByText('Button Text').exists).ok()
    })
    
    test('works with results from "byAll" query with index - regex', async t => {
      const nestedDivs = screen.getAllByTestId(/nested/)
      await t.expect(nestedDivs.count).eql(2)
    
      await t
        .expect(within(nestedDivs.nth(0)).getByText('Button Text').exists)
        .ok()
        .expect(
          within(nestedDivs.nth(1)).getByText('text only in 2nd nested').exists,
        )
        .ok()
    })
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">within</span><span class="token punctuation">(</span><span class="token parameter">selector<span class="token operator">:</span> SelectorArg</span><span class="token punctuation">)</span><span class="token operator">:</span> WithinSelectors <span class="token keyword">import</span> within</code></pre>
    Docs
    0
  • const {rerender} = await render(Counter, {componentProperties: {count: 4}})
    
    expect(screen.getByTestId('count-value').textContent).toBe('4')
    
    rerender({count: 7})
    
    expect(screen.getByTestId('count-value').textContent).toBe('7')
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">const</span> rerender<span class="token operator">:</span> <span class="token builtin">any</span></code></pre>
    Docs
    0
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples