コード例 #1
0
  test("It should clear the search filter when the clear button is clicked", async function(assert) {
    let instances = getInstances();

    port.reopen({
      send(n, m) {
        name = n;
        message = m;
        if (name === 'container:getTypes') {
          this.trigger('container:types', { types: getTypes() });
        }

        if (name === 'container:getInstances' && message.containerType === 'controller') {
          this.trigger('container:instances', { instances, status: 200 });
        }
      }
    });

    await visit('/container-types/controller');
    let rows;

    rows = findAll('.js-container-instance-list-item');
    assert.equal(rows.length, 2, 'expected all rows');

    await fillIn('.js-container-instance-search input', 'xxxxx');
    rows = findAll('.js-container-instance-list-item');
    assert.equal(rows.length, 0, 'expected filtered rows');

    await click('.js-search-field-clear-button');
    rows = findAll('.js-container-instance-list-item');
    assert.equal(rows.length, 2, 'expected all rows');
  });
コード例 #2
0
  test("Reload", async function(assert) {
    let types = [], instances = [];

    port.reopen({
      send(n, m) {
        if (n === 'container:getTypes') {
          this.trigger('container:types', { types });
        }
        if (n === 'container:getInstances' && m.containerType === 'controller') {
          this.trigger('container:instances', { instances, status: 200 });
        }
      }
    });

    await visit('/container-types/controller');

    assert.dom('.js-container-type').doesNotExist();
    assert.dom('.js-container-instance-list-item').doesNotExist();
    types = getTypes();
    instances = getInstances();

    await click('.js-reload-container-btn');

    assert.dom('.js-container-type').exists({ count: 2 });
    assert.dom('.js-container-instance-list-item').exists({ count: 2 });
  });
コード例 #3
0
  test("Container instances are successfully listed", async function(assert) {
    let instances = getInstances();

    port.reopen({
      send(n, m) {
        name = n;
        message = m;
        if (name === 'container:getTypes') {
          this.trigger('container:types', { types: getTypes() });
        }

        if (name === 'container:getInstances' && message.containerType === 'controller') {
          //TODO: these instances are getting no names
          this.trigger('container:instances', { instances, status: 200 });
        }
      }
    });

    await visit('/container-types/controller');
    let rows;

    rows = findAll('.js-container-instance-list-item');

    assert.dom(rows[0]).hasText('first');
    assert.dom(rows[1]).hasText('second');
    name = null;
    message = null;

    await click(rows[0].querySelector('.js-instance-name'));

    assert.equal(name, null);
    await click(rows[1].querySelector('.js-instance-name'));

    assert.equal(name, 'objectInspector:inspectByContainerLookup');

    await fillIn('.js-container-instance-search input', 'first');

    rows = findAll('.js-container-instance-list-item');
    assert.equal(rows.length, 1);
    assert.dom(rows[0]).hasText('first');
  });