Skip to content

Commit 515ae39

Browse files
committed
chore: side ad
1 parent 0cafdd0 commit 515ae39

File tree

5 files changed

+113
-17
lines changed

5 files changed

+113
-17
lines changed

docs/.vitepress/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ const api_sidebar = [
132132
{ text: 'clone', link: '/api/utils/clone', },
133133
{ text: 'parse', link: '/api/utils/parse', },
134134
{ text: 'sleep', link: '/api/utils/sleep' },
135-
{ text: 'findFile', link: '/api/utils/findFile' }
135+
{ text: 'findFile', link: '/api/utils/findFile' },
136+
{ text: 'events', link: '/api/utils/events' },
136137
]
137138
},
138139
{
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<template>
2+
<a class="ad-side-component" href="https://testbeats.com" target="_blank">
3+
<img src="https://testbeats.nyc3.cdn.digitaloceanspaces.com/assets/hero.svg" alt="">
4+
5+
<p class="header">Empower Your Test Results with AI-Powered Insights -></p>
6+
<!-- <p class="tagline">✨ TestBeats ✨</p> -->
7+
<img class="logo" src="https://testbeats.com/static/icons/logo-wordmark-white.svg" alt="">
8+
</a>
9+
</template>
10+
11+
<style scoped>
12+
13+
@keyframes gradient-animation {
14+
0% {
15+
background-position: 0% 50%;
16+
}
17+
50% {
18+
background-position: 100% 50%;
19+
}
20+
100% {
21+
background-position: 0% 50%;
22+
}
23+
}
24+
25+
.ad-side-component {
26+
text-align: center;
27+
margin-top: 2rem;
28+
margin-bottom: 2rem;
29+
padding: 0.5rem 0.85rem;
30+
text-decoration: none;
31+
color: white;
32+
font-size: 1rem;
33+
border-radius: 4px;
34+
background: linear-gradient(45deg, #3538cd, #2c3183, #d3001a, #74000e);
35+
background-size: 300% 300%;
36+
animation: gradient-animation 6s ease-in-out infinite;
37+
}
38+
39+
.ad-side-component .header {
40+
font-weight: 700;
41+
margin-top: 1rem;
42+
}
43+
44+
.ad-side-component .tagline {
45+
font-weight: 500;
46+
font-size: 0.8rem;
47+
margin-top: 1rem;
48+
letter-spacing: 3px;
49+
}
50+
51+
.ad-side-component .logo {
52+
width: 100%;
53+
padding-left: 36px;
54+
padding-right: 36px;
55+
margin-top: 2rem;
56+
margin-bottom: 1rem;
57+
}
58+
</style>

docs/.vitepress/theme/AdComponent.vue

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,14 @@ import Icon from "./Icon.vue";
1616
</template>
1717

1818
<style scoped>
19-
@keyframes pulse {
20-
0% {
21-
border: 1px solid var(--vp-c-divider);
22-
}
23-
50% {
24-
border: 1px solid var(--vp-c-brand);
25-
}
26-
100% {
27-
border: 1px solid var(--vp-c-divider);
28-
}
29-
}
30-
3119
.ad-component {
3220
text-align: center;
3321
margin-bottom: 2rem;
3422
padding: 0.5rem 0.85rem;
35-
border: 2px solid var(--vp-c-brand);
36-
border-radius: 4px;
3723
text-decoration: none;
3824
color: white;
3925
transition: color 0.4s ease-in-out;
4026
font-size: 1rem;
41-
animation: pulse 3s infinite;
4227
background-image: linear-gradient(to top right, #000000, #000842);
4328
}
4429

docs/.vitepress/theme/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
import Theme from 'vitepress/theme'
12
import { h } from 'vue'
23
import '../style/vars.css'
3-
import Theme from 'vitepress/theme'
4+
import AdAsideComponent from './AdAsideComponent.vue'
45
import AdComponent from './AdComponent.vue'
56

67
export default {
78
...Theme,
89
Layout() {
910
return h(Theme.Layout, null, {
1011
'doc-before': () => h(AdComponent),
12+
'aside-outline-after': () => h(AdAsideComponent)
1113
})
1214
},
1315
}

docs/api/utils/events.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# events
2+
3+
The events module provides the `on` methods to listen to events from `pactum`.
4+
5+
Supported Events
6+
7+
- BEFORE_REQUEST
8+
- AFTER_RESPONSE
9+
10+
## Syntax
11+
12+
```js
13+
pactumEvents.on(event-type, callback);
14+
```
15+
16+
17+
## Usage
18+
19+
### ✅ Correct Usage
20+
21+
```js
22+
pactumEvents.on(EVENT_TYPES.BEFORE_REQUEST, (ctx) => {
23+
console.log(ctx);
24+
});
25+
```
26+
27+
## Arguments
28+
29+
#### > event-type (string)
30+
31+
Event type to listen to.
32+
33+
#### > callback (function)
34+
35+
Callback function to call when the event is triggered.
36+
37+
## Examples
38+
39+
### Listening to events
40+
41+
```js
42+
const { pactumEvents, EVENT_TYPES } = require('pactum').events;
43+
44+
pactumEvents.on(EVENT_TYPES.BEFORE_REQUEST, (cxt) => {
45+
console.log(cxt);
46+
});
47+
pactumEvents.on(EVENT_TYPES.AFTER_RESPONSE, (cxt) => {
48+
console.log(cxt.response.body);
49+
});
50+
```

0 commit comments

Comments
 (0)