Add class names for integration tests

This commit is contained in:
Borys_Levytskyi
2021-01-14 12:39:24 +02:00
parent 227e5b597a
commit a0d0a81289
2 changed files with 10 additions and 5 deletions

View File

@@ -5,18 +5,19 @@ export type BinaryStringViewProps = {
binaryString: string; binaryString: string;
onFlipBit?: (input: FlipBitEventArg) => void; onFlipBit?: (input: FlipBitEventArg) => void;
emphasizeBytes: boolean; emphasizeBytes: boolean;
className?:string
}; };
export type FlipBitEventArg = { export type FlipBitEventArg = {
index: number; index: number;
binaryString: string; binaryString: string;
$event: any; $event: any;
newBinaryString: string newBinaryString: string,
}; };
export default class BinaryStringView extends React.Component<BinaryStringViewProps> { export default class BinaryStringView extends React.Component<BinaryStringViewProps> {
render() { render() {
return <span>{this.getChildren()}</span> return <span className={this.props.className}>{this.getChildren()}</span>
} }
onBitClick(index: number, e : any) { onBitClick(index: number, e : any) {

View File

@@ -21,9 +21,12 @@ export class IpAddressView extends React.Component<IpAddressViewProps>
return <table className="expression"> return <table className="expression">
<tbody> <tbody>
{this.props.ipAddresses.map((ip, i) => <tr key={i}> {this.props.ipAddresses.map((ip, i) => <tr key={i}>
<td><strong>{ip.toString()}</strong></td> <td className="label"><strong>{ip.toString()}</strong></td>
<td> <td>
{this.bin(ip.firstByte, 1, ip)}.{this.bin(ip.secondByte, 2, ip)}.{this.bin(ip.thirdByte, 3, ip)}.{this.bin(ip.fourthByte, 4, ip)} {this.bin(ip.firstByte, 1, ip)}<span className="soft">.</span>
{this.bin(ip.secondByte, 2, ip)}<span className="soft">.</span>
{this.bin(ip.thirdByte, 3, ip)}<span className="soft">.</span>
{this.bin(ip.fourthByte, 4, ip)}
</td> </td>
</tr>)} </tr>)}
</tbody> </tbody>
@@ -61,7 +64,8 @@ export class IpAddressView extends React.Component<IpAddressViewProps>
binaryString={fmt(value)} binaryString={fmt(value)}
key={octetNumber} key={octetNumber}
emphasizeBytes={false} emphasizeBytes={false}
allowFlipBits={true} allowFlipBits={true}
className={`octet-${octetNumber}`}
onFlipBit={e => this.onFlippedBit(e.newBinaryString, octetNumber, ip)} />; onFlipBit={e => this.onFlippedBit(e.newBinaryString, octetNumber, ip)} />;
} }