<commit_before>import Em from 'ember';
import { test } from 'ember-qunit';
import startApp from '../helpers/start-app';
import {
  checkController,
  checkModel,
  checkTemplate,
  checkView,
  testModal
} from '../helpers/checks';

/* QUnit helpers */

var contains = QUnit.contains;
var isFunction = QUnit.isFunction;
var typeOf = QUnit.typeOf;

var App, container;

module('Modals - Using multiple modals', {

  setup: function() {
    App = startApp();
    container = App.__container__;
  },

  teardown: function() {
    Em.run(App, 'reset');
  }

});


test('Changing between outlets', function() {
  var options = {
    template: 'modals/modal-one'
  };

  var renderingOptions = {
    outlet: 'modal-on-index',
    parentView: 'index'
  }

  visit('/');

  showModal(options);

  andThen(function() {
    testModal(options);
  });

  asyncClick('close');

  showModal(options, renderingOptions);

  andThen(function() {
    testModal(options, renderingOptions);
  });
});<commit_msg>Added tests for showing two modals at the same time<commit_after>import Em from 'ember';
import { test } from 'ember-qunit';
import startApp from '../helpers/start-app';
import {
  checkController,
  checkModel,
  checkTemplate,
  checkView,
  testModal
} from '../helpers/checks';

/* QUnit helpers */

var contains = QUnit.contains;
var isFunction = QUnit.isFunction;
var typeOf = QUnit.typeOf;

var App, container;

module('Modals - Using multiple modals', {

  setup: function() {
    App = startApp();
    container = App.__container__;
  },

  teardown: function() {
    Em.run(App, 'reset');
  }

});


test('Changing between outlets on the same route', function() {
  var options = {
    template: 'modals/modal-one'
  };

  var renderingOptions = {
    outlet: 'modal-two'
  }

  expect(12);

  visit('/');

  showModal(options);

  andThen(function() {
    testModal(options);
  });

  asyncClick('close');

  showModal(options, renderingOptions);

  andThen(function() {
    testModal(options, renderingOptions);
  });
});


test('Changing between outlets on different views', function() {
  var options = {
    template: 'modals/modal-one'
  };

  var renderingOptions = {
    outlet: 'modal-on-index',
    parentView: 'index'
  }

  expect(12);

  visit('/');

  showModal(options);

  andThen(function() {
    testModal(options);
  });

  asyncClick('close');

  showModal(options, renderingOptions);

  andThen(function() {
    testModal(options, renderingOptions);
  });
});


test('Showing two modals at the same time', function() {
  var options = {
    template: 'modals/modal-one'
  };

  var optionsAlt = {
    template: 'modals/modal-two'
  }

  var renderingOptions = {
    outlet: 'modal-on-index',
    parentView: 'index'
  }

  expect(19);

  visit('/');

  showModal(options);

  andThen(function() {
    testModal(options);
  });

  showModal(optionsAlt, renderingOptions);

  andThen(function() {
    testModal(optionsAlt, renderingOptions);
  });

  asyncClick('close');

  andThen(function() {

    ok(inspect('close', false),
      'Should still be one close button in the DOM');

    /* Original modal should still be in the DOM */

    testModal(options);

  });
});
{'fraction_non_alphanumeric': 0.15068922305764412, 'fraction_numerical': 0.0018796992481203006, 'mean_word_length': 3.4719887955182074, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '920998', 'n_tokens_mistral': 1064, 'n_tokens_neox': 1014, 'n_words': 238}