import { createElement as h, render, createPortal } from '../../src';
import { setupScratch, teardown } from '../../../test/_util/helpers';
/* eslint-disable react/jsx-boolean-value, react/display-name, prefer-arrow-callback */

/** @jsx h */
describe('Portal', () => {

	/** @type {HTMLDivElement} */
	let scratch;

	beforeEach(() => {
		scratch = setupScratch();
	});

	afterEach(() => {
		teardown(scratch);
	});

	it('should render into a different root node', () => {
		let root = document.createElement('div');
		document.body.appendChild(root);

		function Foo(props) {
			return <div>{createPortal(props.children, root)}</div>;
		}
		render(<Foo>foobar</Foo>, scratch);

		expect(root.innerHTML).to.equal('foobar');
	});

	it("should not render <undefined> for Portal nodes", () => {
		let root = document.createElement('div');
		let dialog = document.createElement('div');
		dialog.id = 'container';

		scratch.appendChild(root);
		scratch.appendChild(dialog);

		function Dialog() {
			return <div>Dialog content</div>
		}

		function App() {
			return <div>
				{createPortal(<Dialog/>, dialog)}
			</div>
		}

		render(<App/>, root);
		expect(scratch.firstChild.firstChild.childNodes.length).to.equal(0);
	});
});

@@ -727,17 +727,17 @@
 );%0A%0A%09it(
-%22
+'
 should n
@@ -778,9 +778,9 @@
 odes
-%22
+'
 , ()
@@ -1017,24 +1017,25 @@
 ontent%3C/div%3E
+;
 %0A%09%09%7D%0A%0A%09%09func
@@ -1061,14 +1061,21 @@
 urn 
+(%0A%09%09%09%09
 %3Cdiv%3E%0A
+%09
 %09%09%09%09
@@ -1095,16 +1095,17 @@
 (%3CDialog
+ 
 /%3E, dial
@@ -1116,15 +1116,22 @@
 %0A%09%09%09
+%09
 %3C/div%3E%0A
+%09%09%09);%0A
 %09%09%7D%0A
@@ -1144,16 +1144,17 @@
 der(%3CApp
+ 
 /%3E, root

Fix linting errors in portals test