Skip to content

Commit c638867

Browse files
author
Brandon Dail
committed
Skeleton outline for a selection events fixture set
1 parent fccd11b commit c638867

File tree

4 files changed

+63
-41
lines changed

4 files changed

+63
-41
lines changed

fixtures/dom/src/components/App.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,7 @@ import '../style.css';
55
const React = window.React;
66

77
function App() {
8-
return (
9-
<div>
10-
<Header />
11-
<div className="container">
12-
<Fixtures />
13-
</div>
14-
</div>
15-
);
8+
return <Fixtures />;
169
}
1710

1811
export default App;

fixtures/dom/src/components/Header.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class Header extends React.Component {
6464
<option value="/event-pooling">Event Pooling</option>
6565
<option value="/custom-elements">Custom Elements</option>
6666
<option value="/media-events">Media Events</option>
67+
<option value="/selection-events">Selection Events</option>
6768
</select>
6869
</label>
6970
<label htmlFor="react_version">
Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import Header from '../Header';
2+
13
import RangeInputFixtures from './range-inputs';
24
import TextInputFixtures from './text-inputs';
35
import SelectFixtures from './selects';
@@ -11,44 +13,43 @@ import ErrorHandling from './error-handling';
1113
import EventPooling from './event-pooling';
1214
import CustomElementFixtures from './custom-elements';
1315
import MediaEventsFixtures from './media-events';
16+
import {
17+
SelectionEventFixtureRoot,
18+
SelectionEventFixtureIFrame,
19+
} from './selection-events';
1420

1521
const React = window.React;
1622

17-
/**
18-
* A simple routing component that renders the appropriate
19-
* fixture based on the location pathname.
20-
*/
23+
const RouteConfig = {
24+
'/text-inputs': <TextInputFixtures />,
25+
'/range-inputs': <RangeInputFixtures />,
26+
'/selects': <SelectFixtures />,
27+
'/textareas': <TextAreaFixtures />,
28+
'/input-change-events': <InputChangeEvents />,
29+
'/number-inputs': <NumberInputFixtures />,
30+
'/password-inputs': <PasswordInputFixtures />,
31+
'/buttons': <ButtonFixtures />,
32+
'/date-inputs': <DateInputFixtures />,
33+
'/error-handling': <ErrorHandling />,
34+
'/event-pooling': <EventPooling />,
35+
'/custom-elements': <CustomElementFixtures />,
36+
'/media-events': <MediaEventsFixtures />,
37+
'/selection-events': <SelectionEventFixtureRoot />,
38+
};
39+
2140
function FixturesPage() {
22-
switch (window.location.pathname) {
23-
case '/text-inputs':
24-
return <TextInputFixtures />;
25-
case '/range-inputs':
26-
return <RangeInputFixtures />;
27-
case '/selects':
28-
return <SelectFixtures />;
29-
case '/textareas':
30-
return <TextAreaFixtures />;
31-
case '/input-change-events':
32-
return <InputChangeEvents />;
33-
case '/number-inputs':
34-
return <NumberInputFixtures />;
35-
case '/password-inputs':
36-
return <PasswordInputFixtures />;
37-
case '/buttons':
38-
return <ButtonFixtures />;
39-
case '/date-inputs':
40-
return <DateInputFixtures />;
41-
case '/error-handling':
42-
return <ErrorHandling />;
43-
case '/event-pooling':
44-
return <EventPooling />;
45-
case '/custom-elements':
46-
return <CustomElementFixtures />;
47-
case '/media-events':
48-
return <MediaEventsFixtures />;
49-
default:
50-
return <p>Please select a test fixture.</p>;
41+
const {pathname} = window.location;
42+
if (pathname === '/selection-events-iframe') {
43+
return <SelectionEventFixtureIFrame />;
5144
}
45+
return (
46+
<div>
47+
<Header />
48+
<div className="container">
49+
{RouteConfig[pathname] || <p>Please select a test fixture.</p>}
50+
</div>
51+
</div>
52+
);
5253
}
5354

5455
export default FixturesPage;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React, {Component} from 'react';
2+
import FixtureSet from '../../FixtureSet';
3+
import TestCase from '../../TestCase';
4+
5+
export class SelectionEventFixtureRoot extends Component {
6+
render() {
7+
return (
8+
<FixtureSet title="Selection Events - iframes" description="">
9+
<TestCase
10+
title="Selection events across iframes"
11+
description="Selection events should work within iframes">
12+
<TestCase.Steps>
13+
<li>TODO</li>
14+
</TestCase.Steps>
15+
<TestCase.ExpectedResult>TODO</TestCase.ExpectedResult>
16+
<iframe src="/selection-events-iframe" />
17+
</TestCase>
18+
</FixtureSet>
19+
);
20+
}
21+
}
22+
23+
export class SelectionEventFixtureIFrame extends Component {
24+
render() {
25+
return <div>I'm in an iframe. TODO</div>;
26+
}
27+
}

0 commit comments

Comments
 (0)