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

View File

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