-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestActionFormComponent.vue
More file actions
58 lines (52 loc) · 2.28 KB
/
TestActionFormComponent.vue
File metadata and controls
58 lines (52 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<template>
<div>
<v-select outlined dense :value="action.type" @input="updateActionField('type', $event)"
:items="actionTypes" label="Type"></v-select>
<v-text-field v-if="action.type === 'click' || action.type === 'focus' || action.type === 'hover' ||
action.type === 'waitForSelector'"
outlined dense label="Selector"
:value="action.selector" @input="updateActionField('selector', $event)"
></v-text-field>
<v-text-field v-else-if="action.type === 'waitForTimeout'"
outlined dense label="Delay" type="number"
:value="action.delay" @input="updateActionField('delay', $event)"
></v-text-field>
<v-text-field v-else-if="action.type === 'pressKey'"
outlined dense label="Key"
:value="action.key" @input="updateActionField('key', $event)"
></v-text-field>
<v-text-field v-else-if="action.type === 'type'"
outlined dense label="Text"
:value="action.text" @input="updateActionField('text', $event)"
></v-text-field>
<div v-else-if="action.type === 'mouseMove'">
<v-text-field class="flex-grow-1 flex-shrink-1" outlined dense label="X coordinate" type="number"
:value="action.coordinate.x" @input="updateCurrentActionCoordinateField('x', parseInt($event))"
></v-text-field>
<v-text-field class="flex-grow-1 flex-shrink-1" outlined dense label="Y coordinate" type="number"
:value="action.coordinate.y" @input="updateCurrentActionCoordinateField('y', parseInt($event))"
></v-text-field>
</div>
</div>
</template>
<script lang="ts">
import { TestAction } from "@/models/testAction";
import { Vue, Component, Prop } from "vue-property-decorator";
@Component
export default class TestActionFormComponent extends Vue {
@Prop({ required: true, type: Object })
private readonly action!: TestAction;
private actionTypes: string[];
constructor() {
super(arguments);
this.actionTypes = ["click", "focus", "hover", "waitForTimeout",
"waitForSelector", "pressKey", "type", "mouseMove"];
}
private updateActionField(field: string, value: unknown) {
this.$emit("action-field-updated", field, value);
}
private updateCurrentActionCoordinateField(field: string, value: number) {
this.$emit("action-coordinate-field-updated", field, value);
}
}
</script>