<commit_before>'use strict';

import { async } from 'metal';
import dom from 'metal-dom';
import Modal from '../src/Modal';
import { SoyTemplates } from 'metal-soy';

var modal;

describe('Modal', function() {
	afterEach(function() {
		if (modal) {
			modal.dispose();
		}
	});

	it('should render with default attributes', function() {
		modal = new Modal().render();
		var header = modal.getSurfaceElement('header').innerHTML;
		var body = modal.getSurfaceElement('body').innerHTML;
		var footer = modal.getSurfaceElement('footer').innerHTML;
		assert.strictEqual('', header);
		assert.strictEqual('', body);
		assert.strictEqual('', footer);
		assert.strictEqual('block', modal.element.style.display);
	});

	it('should render with header only', function() {
		modal = new Modal({
			header: 'header'
		}).render();
		var headerElement = modal.getSurfaceElement('header');
		var body = modal.getSurfaceElement('body').innerHTML;
		var footer = modal.getSurfaceElement('footer').innerHTML;
		assert.strictEqual('header', headerElement.childNodes[1].textContent);
		assert.ok(dom.hasClass(headerElement.childNodes[0], 'close'));
		assert.strictEqual('', body);
		assert.strictEqual('', footer);
	});

	it('should render with body only', function() {
		modal = new Modal({
			body: 'body'
		}).render();
		var header = modal.getSurfaceElement('header').innerHTML;
		var body = modal.getSurfaceElement('body').innerHTML;
		var footer = modal.getSurfaceElement('footer').innerHTML;
		assert.strictEqual('', header);
		assert.strictEqual('body', body);
		assert.strictEqual('', footer);
	});

	it('should render with footer only', function() {
		modal = new Modal({
			footer: 'footer'
		}).render();
		var header = modal.getSurfaceElement('header').innerHTML;
		var body = modal.getSurfaceElement('body').innerHTML;
		var footer = modal.getSurfaceElement('footer').innerHTML;
		assert.strictEqual('', header);
		assert.strictEqual('', body);
		assert.strictEqual('footer', footer);
	});

	it('should cause dom repaint when body attribute change', function(done) {
		modal = new Modal().render();
		modal.body = 'body';
		async.nextTick(function() {
			var body = modal.getSurfaceElement('body').innerHTML;
			assert.strictEqual('body', body);
			done();
		});
	});

	it('should cause dom repaint when header attribute change', function(done) {
		modal = new Modal().render();
		modal.header = 'header';
		async.nextTick(function() {
			var header = modal.getSurfaceElement('header');
			assert.strictEqual('header', header.childNodes[1].textContent);
			assert.ok(dom.hasClass(header.childNodes[0], 'close'));
			done();
		});
	});

	it('should cause dom repaint when footer attribute change', function(done) {
		modal = new Modal().render();
		modal.footer = 'footer';
		async.nextTick(function() {
			var footer = modal.getSurfaceElement('footer').innerHTML;
			assert.strictEqual('footer', footer);
			done();
		});
	});

	it('should cause dom repaint when visible attribute change', function(done) {
		modal = new Modal().render();
		modal.visible = false;
		async.nextTick(function() {
			assert.strictEqual('', modal.element.style.display);
<commit_msg>Fixes tests due to changes on dependencies<commit_after>'use strict';

import { async } from 'metal';
import dom from 'metal-dom';
import Modal from '../src/Modal';
import { SoyTemplates } from 'metal-soy';

var modal;

describe('Modal', function() {
	afterEach(function() {
		if (modal) {
			modal.dispose();
		}
	});

	it('should render with default attributes', function() {
		modal = new Modal().render();
		var header = modal.element.querySelector('.modal-header');
		var body = modal.element.querySelector('.modal-body');
		var footer = modal.element.querySelector('.modal-footer');
		assert.strictEqual('', header.innerHTML);
		assert.strictEqual('', body.innerHTML);
		assert.strictEqual('', footer.innerHTML);
		assert.strictEqual('block', modal.element.style.display);
	});

	it('should render with header only', function() {
		modal = new Modal({
			header: 'header'
		}).render();
		var headerElement = modal.element.querySelector('.modal-header');
		var body = modal.element.querySelector('.modal-body').innerHTML;
		var footer = modal.element.querySelector('.modal-footer').innerHTML;
		assert.strictEqual('header', headerElement.childNodes[1].textContent);
		assert.ok(dom.hasClass(headerElement.childNodes[0], 'close'));
		assert.strictEqual('', body);
		assert.strictEqual('', footer);
	});

	it('should render with body only', function() {
		modal = new Modal({
			body: 'body'
		}).render();
		var header = modal.element.querySelector('.modal-header').innerHTML;
		var body = modal.element.querySelector('.modal-body').innerHTML;
		var footer = modal.element.querySelector('.modal-footer').innerHTML;
		assert.strictEqual('', header);
		assert.strictEqual('body', body);
		assert.strictEqual('', footer);
	});

	it('should render with footer only', function() {
		modal = new Modal({
			footer: 'footer'
		}).render();
		var header = modal.element.querySelector('.modal-header').innerHTML;
		var body = modal.element.querySelector('.modal-body').innerHTML;
		var footer = modal.element.querySelector('.modal-footer').innerHTML;
		assert.strictEqual('', header);
		assert.strictEqual('', body);
		assert.strictEqual('footer', footer);
	});

	it('should cause dom repaint when body attribute change', function(done) {
		modal = new Modal().render();
		modal.body = 'body';
		async.nextTick(function() {
			var body = modal.element.querySelector('.modal-body').innerHTML;
			assert.strictEqual('body', body);
			done();
		});
	});

	it('should cause dom repaint when header attribute change', function(done) {
		modal = new Modal().render();
		modal.header = 'header';
		async.nextTick(function() {
			var header = modal.element.querySelector('.modal-header');
			assert.strictEqual('header', header.childNodes[1].textContent);
			assert.ok(dom.hasClass(header.childNodes[0], 'close'));
			done();
		});
	});

	it('should cause dom repaint when footer attribute change', function(done) {
		modal = new Modal().render();
		modal.footer = 'footer';
		async.nextTick(function() {
			var footer = modal.element.querySelector('.modal-footer').innerHTML;
			assert.strictEqual('footer', footer);
			done();
		});
	});

	it('should cause dom repaint when visible attribute change', function(done) {
		modal = new Modal().render();
		modal.visible = false;
		async.nextTick(function() {
			assert.strictEqual('', modal.element.style.display);

{'fraction_non_alphanumeric': 0.17040565457897972, 'fraction_numerical': 0.001229256299938537, 'mean_word_length': 4.832437275985663, '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': '710253', 'n_tokens_mistral': 2094, 'n_tokens_neox': 1880, 'n_words': 440}