How to use the qunit.test function in qunit

To help you get started, we’ve selected a few 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 / data / packages / model / node-tests / fixtures / model-test / post-default.js View on Github external
module('Unit | Model | post', function(hooks) {
  setupTest(hooks);

  // Replace this with your real tests.
  test('it exists', function(assert) {
    let store = this.owner.lookup('service:store');
    let model = store.createRecord('post', {});
    assert.ok(model);
  });
});
github sympmarc / SPServices / test / general.js View on Github external
var QUnit = require('qunit');
    var $ = require('jquery');
    var equal = require('equal');

    // A few QUnit configuration settings
    // For more, see: http://api.qunitjs.com/QUnit.config/
    QUnit.config.autostart = false;
    QUnit.config.reorder = false;

    /* Setup variables */
    var testList = {};
    testList.Name = new Date().toString();
    testList.Description = "This is the test description.";

    QUnit.test("Version", function (assert) {
        var v = $().SPServices.Version();
        assert.ok(v !== undefined, "Passed! Ver =::" + v + "::");
    });

    QUnit.test("SPGetQueryString", function (assert) {
        var qs = $().SPServices.SPGetQueryString();
        assert.ok(qs !== undefined, "Passed! SPGetQueryString =::" + qs + "::");
    });

    QUnit.test("SPGetCurrentUser", function (assert) {
        var currentUser = $().SPServices.SPGetCurrentUser();
        assert.ok(currentUser !== undefined, "Passed! SPCurrentUser =::" + currentUser + "::");
    });

    QUnit.test("SPGetCurrentSite", function (assert) {
        var currentSite = $().SPServices.SPGetCurrentSite();
github ractivejs / ractive / tests / browser / plugins / adaptors / basic.js View on Github external
},
    wrap(ractive, foo) {
      const wrapper = {
        get() {
          return foo.content;
        },
        teardown() {
          delete foo._wrapper;
        }
      };
      foo._wrapper = wrapper;
      return wrapper;
    }
  };

  test('Adaptors can change data as it is .set() (#442)', t => {
    const model = new Model({
      foo: 'BAR',
      percent: 150
    });

    model.transform('foo', newValue => {
      return newValue.toLowerCase();
    });

    model.transform('percent', newValue => {
      return Math.min(100, Math.max(0, newValue));
    });

    const ractive = new Ractive({
      el: fixture,
      template: '<p>{{model.foo}}</p><p>{{model.percent}}</p>',
github gpujs / gpu.js / test / features / unsigned-precision-textures.js View on Github external
return packed[this.thread.y][this.thread.x];
  }, {
    output: [9, 2],
    precision: 'unsigned'
  });

  const result = kernel(original);
  assert.deepEqual(result.map(array => Array.from(array)), original.map(array => Array.from(array)));
  gpu.destroy();
}

(GPU.isKernelMapSupported ? test : skip)('with Array2D auto', () => {
  unsignedPrecisionTexturesWithArray2D();
});

test('with Array2D cpu', () => {
  unsignedPrecisionTexturesWithArray2D('cpu');
});

(GPU.isKernelMapSupported ? test : skip)('with Array2D gpu', () => {
  unsignedPrecisionTexturesWithArray2D('gpu');
});

(GPU.isWebGLSupported && GPU.isKernelMapSupported ? test : skip)('with Array2D webgl', () => {
  unsignedPrecisionTexturesWithArray2D('webgl');
});

(GPU.isWebGL2Supported ? test : skip)('with Array2D webgl2', () => {
  unsignedPrecisionTexturesWithArray2D('webgl2');
});

(GPU.isHeadlessGLSupported && GPU.isKernelMapSupported ? test : skip)('with Array2D headlessgl', () => {
github gpujs / gpu.js / test / features / bitwise-operators.js View on Github external
const kernel = gpu.createKernel(function(v1, v2) {
    return v1 &gt;&gt; v2;
  })
    .setOutput([1])
    .setPrecision('unsigned');

  for (let i = 0; i &lt; 10; i++) {
    for (let j = 0; j &lt; 10; j++) {
      assert.equal(kernel(i, j)[0], i &gt;&gt; j);
    }
  }

  gpu.destroy();
}

test('bitwise signed fill right shift unsigned precision auto', () =&gt; {
  testBitwiseSignedRightShiftUnsignedPrecision();
});

test('bitwise signed fill right shift unsigned precision gpu', () =&gt; {
  testBitwiseSignedRightShiftUnsignedPrecision('gpu');
});

(GPU.isWebGLSupported ? test : skip)('bitwise signed fill right shift unsigned precision webgl', () =&gt; {
  testBitwiseSignedRightShiftUnsignedPrecision('webgl');
});

(GPU.isWebGL2Supported ? test : skip)('bitwise signed fill right shift unsigned precision webgl2', () =&gt; {
  testBitwiseSignedRightShiftUnsignedPrecision('webgl2');
});

(GPU.isHeadlessGLSupported ? test : skip)('bitwise signed fill right shift unsigned precision headlessgl', () =&gt; {
github sukima / ember-class-based-modifier / tests / integration / modifier-managers / shared.js View on Github external
}

          called = _called;
        }
      };
    });

    hooks.afterEach(async function(assert) {
      await settled();

      assert.strictEqual(this.instance.isDestroying, true, 'isDestroying');
      assert.strictEqual(this.instance.isDestroyed, true, 'isDestroyed');
    });

    if (element) {
      test('it has access to the DOM element', async function(assert) {
        this.hook(instance =&gt; {
          assert.equal(instance.element.tagName, 'H1', 'this.element.tagName');
          assert.equal(instance.element.id, 'expected', 'this.element.id');
        });

        assert.step('no-op render');

        await this.assertCalled(false, async () =&gt; {
          this.setProperties({
            isShowing: false,
            foo: 'foo',
          });

          await render(hbs`
            {{#if this.isShowing}}
              <h1 id="expected">Hello</h1>
github danielspaniel / ember-data-factory-guy / tests / unit / shared-adapter-behaviour.js View on Github external
.catch(() => assert.ok(true, 'update failed the first time'))
             .then(() => {
               updateMock.succeeds();
               assert.ok(!profile.get('valid'), "Profile is invalid.");

               profile.save().then(() => {
                   assert.ok(!profile.get('saving'), "Saved model");
                   assert.ok(profile.get('description') === 'new desc', "Description was updated.");
                   done();
                 }
               );
             });
    });
  });

  test("match can take a function - it can accept FormData as requestBody", async function(assert) {
    assert.expect(2);
    run(async () => {
      let customDescription = "special description",
          profile           = make('profile'),
          updateMock        = mockUpdate(profile),
          adapter           = FactoryGuy.store.adapterFor('profile');

      adapter.updateRecord = (store, type, snapshot) => {
        let url = adapter.urlForUpdateRecord(snapshot.id, type.modelName, snapshot);
        let httpMethod = FactoryGuy.updateHTTPMethod(type.modelName);
        let fd = new FormData();
        fd.append('description', snapshot.attr('description'));
        adapter.ajax(url, httpMethod, {
          data: fd,
          processData: false,
          contentType: false,
github ractivejs / ractive / tests / browser / init / hooks / misc.js View on Github external
let component = null;

    new Ractive({
      el: fixture,
      data: { show: true },
      template: '{{#show}}{{/}}',
      components: { Component },
      oninit() {
        component = this.findComponent('Component');
      }
    });

    t.ok(component);
  });

  test('render hooks are not fired until after DOM updates (#1367)', t =&gt; {
    t.expect(0);

    const ractive = new Ractive({
      el: fixture,
      template: '',
      components: {
        one: Ractive.extend({
          template: `
						{{#if bool}}
							<p></p>
						{{/if}}

						{{#if bool}}
							
						{{/if}}`
        }),
github ractivejs / ractive / tests / browser / init / extend.js View on Github external
t.strictEqual(template.t.length, 0, 'has no items');
  });

  test('Empty template', t => {
    const Parent = Ractive.extend({ template: '' });
    const Child = Parent.extend();
    const template = Child.prototype.template;

    t.ok(template, 'on prototype');
    t.ok(Object.prototype.toString.call(template), 'is an object');
    t.ok(template.v, 'has a version');
    t.ok(template.t, 'has a template');
    t.strictEqual(template.t.length, 0, 'has no items');
  });

  test('Non-empty template', t => {
    const Parent = Ractive.extend({ template: '' });
    const Child = Parent.extend({ template: '{{ foo }}' });
    const template = Child.prototype.template;

    t.deepEqual(template, { v: 4, t: [{ r: 'foo', t: 2 }] });
  });

  test('Multiple configuration', t => {
    const Parent = Ractive.extend({ template: '' });
    const Child = Parent.extend({ template: '{{ foo }}' }, { template: '{{ bar }}' });
    const template = Child.prototype.template;

    t.deepEqual(template, { v: 4, t: [{ r: 'bar', t: 2 }] });
  });

  test('Child parse options', t => {