How to use ember-qunit - 10 common examples

To help you get started, we’ve selected a few ember-qunit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github emberjs / ember.js / node-tests / fixtures / helper-test / integration.js View on Github external
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

moduleForComponent('foo/bar-baz', 'helper:foo/bar-baz', {
  integration: true
});

// Replace this with your real tests.
test('it renders', function(assert) {
  this.set('inputValue', '1234');

  this.render(hbs`{{foo/bar-baz inputValue}}`);

  assert.equal(this.$().text().trim(), '1234');
});
github sukima / ember-cli-select-picker / tests / common / select-picker.js View on Github external
'contentList should not be filtered when searchFilter is cleared'
    );

    Ember.run(function() {
      component.set('searchFilter', 'itm');
    });

    // When search is set to normal (not advanced), searching for 'itm' should
    // give 0 results
    assert.equal(
      component.get('contentList.length'), 0,
      'contentList should be filtered to no results for "itm"'
    );
  });

  test('Advanced Search (multiple)', function(assert) {
    assert.expect(2);

    var component = this.subject({
      multiple: true,
      liveSearch: 'advanced',
      content: contentArray,
      selection: Ember.A(),
      optionValuePath: 'content.id',
      optionLabelPath: 'content.name'
    });

    assert.equal(
      component.get('contentList.length'), contentArray.length,
      'contentList should not be filtered initially'
    );
github DefinitelyTyped / DefinitelyTyped / types / ember-qunit / ember-qunit-tests.ts View on Github external
// render the component
    this.render(hbs`
        {{ x-foo value=value action="result" }}
    `);
    this.render('{{ x-foo value=value action="result" }}');
    this.render([
        '{{ x-foo value=value action="result" }}'
    ]);

    assert.equal(this.$('div>.value').text(), 'cat', 'The component shows the correct value');

    this.$('button').click();
});

test('it renders', function(assert) {
    assert.expect(1);

    // creates the component instance
    const subject = this.subject();

    const subject2 = this.subject({
        item: 42
    });

    const { inputFormat } = this.setProperties({
        inputFormat: 'M/D/YY',
        outputFormat: 'MMMM D, YYYY',
        date: '5/3/10'
    });

    const { inputFormat: if2, outputFormat } = this.getProperties('inputFormat', 'outputFormat');
github ember-codemods / ember-test-helpers-codemod / transforms / integration / __testfixtures__ / selected.input.js View on Github external
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

moduleForComponent('foo-bar', 'Integration | Component | foo bar', {
  integration: true
});


test(':selected is replaced correctly', function(assert) {
  // find
  const checkedVal = this.$('.foo input:selected').val();
  assert.equal(checkedVal, 13);

  // findAll
  const checkedCount = this.$('select option:selected').length;
  assert.equal(checkedCount, 3);

  // Multiple jQuery selectors
  const firstChecked = this.$('.foo input:selected:eq(0)').val();
  const secondChecked = this.$('.foo input:selected:eq(2)').val();
github emberjs / ember.js / node-tests / fixtures / component-test / default.js View on Github external
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

moduleForComponent('x-foo', 'Integration | Component | x-foo', {
  integration: true
});

test('it renders', function(assert) {
  // Set any properties with this.set('myProperty', 'value');
  // Handle any actions with this.on('myAction', function(val) { ... });

  this.render(hbs``);

  assert.equal(this.$().text().trim(), '');

  // Template block usage:
  this.render(hbs`
    
      template block text
github emberjs / data / packages / adapter / node-tests / fixtures / adapter-test / foo-default.js View on Github external
module('Unit | Adapter | foo', function(hooks) {
  setupTest(hooks);

  // Replace this with your real tests.
  test('it exists', function(assert) {
    let adapter = this.owner.lookup('adapter:foo');
    assert.ok(adapter);
  });
});
github emberjs / data / packages / serializer / node-tests / fixtures / serializer-test / rfc232.js View on Github external
module('Unit | Serializer | foo', function(hooks) {
  setupTest(hooks);

  // Replace this with your real tests.
  test('it exists', function(assert) {
    let store = this.owner.lookup('service:store');
    let serializer = store.serializerFor('foo');

    assert.ok(serializer);
  });

  test('it serializes records', function(assert) {
    let store = this.owner.lookup('service:store');
    let record = store.createRecord('foo', {});

    let serializedRecord = record.serialize();

    assert.ok(serializedRecord);
github emberjs / data / packages / serializer / blueprints / transform-test / qunit-files / __root__ / __path__ / __test__.js View on Github external
module('<%= friendlyTestDescription %>', function(hooks) {
  setupTest(hooks);

  // Replace this with your real tests.
  test('it exists', function(assert) {
    let transform = this.owner.lookup('transform:<%= dasherizedModuleName %>');
    assert.ok(transform);
  });
});
github emberjs / data / packages / serializer / blueprints / serializer-test / qunit-files / __root__ / __path__ / __test__.js View on Github external
module('<%= friendlyTestDescription %>', function(hooks) {
  setupTest(hooks);

  // Replace this with your real tests.
  test('it exists', function(assert) {
    let store = this.owner.lookup('service:store');
    let serializer = store.serializerFor('<%= dasherizedModuleName %>');

    assert.ok(serializer);
  });

  test('it serializes records', function(assert) {
    let store = this.owner.lookup('service:store');
    let record = store.createRecord('<%= dasherizedModuleName %>', {});

    let serializedRecord = record.serialize();

    assert.ok(serializedRecord);
github CenterForOpenScience / ember-osf-web / tests / unit / models / user-registration.ts View on Github external
module('Unit | Model | user-registration', hooks => {
    setupTest(hooks);

    // Replace this with your real tests.
    test('it exists', function(assert) {
        const store = this.owner.lookup('service:store');
        const model = run(() => store.createRecord('user-registration', {}));
        assert.ok(model);
    });
});