Skip to content

Commit

Permalink
chore: side ad
Browse files Browse the repository at this point in the history
  • Loading branch information
ASaiAnudeep committed Aug 15, 2024
1 parent 0cafdd0 commit 515ae39
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 17 deletions.
3 changes: 2 additions & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ const api_sidebar = [
{ text: 'clone', link: '/api/utils/clone', },
{ text: 'parse', link: '/api/utils/parse', },
{ text: 'sleep', link: '/api/utils/sleep' },
{ text: 'findFile', link: '/api/utils/findFile' }
{ text: 'findFile', link: '/api/utils/findFile' },
{ text: 'events', link: '/api/utils/events' },
]
},
{
Expand Down
58 changes: 58 additions & 0 deletions docs/.vitepress/theme/AdAsideComponent.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<template>
<a class="ad-side-component" href="https://testbeats.com" target="_blank">
<img src="https://testbeats.nyc3.cdn.digitaloceanspaces.com/assets/hero.svg" alt="">

<p class="header">Empower Your Test Results with AI-Powered Insights -></p>
<!-- <p class="tagline">✨ TestBeats ✨</p> -->
<img class="logo" src="https://testbeats.com/static/icons/logo-wordmark-white.svg" alt="">
</a>
</template>

<style scoped>
@keyframes gradient-animation {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
.ad-side-component {
text-align: center;
margin-top: 2rem;
margin-bottom: 2rem;
padding: 0.5rem 0.85rem;
text-decoration: none;
color: white;
font-size: 1rem;
border-radius: 4px;
background: linear-gradient(45deg, #3538cd, #2c3183, #d3001a, #74000e);
background-size: 300% 300%;
animation: gradient-animation 6s ease-in-out infinite;
}
.ad-side-component .header {
font-weight: 700;
margin-top: 1rem;
}
.ad-side-component .tagline {
font-weight: 500;
font-size: 0.8rem;
margin-top: 1rem;
letter-spacing: 3px;
}
.ad-side-component .logo {
width: 100%;
padding-left: 36px;
padding-right: 36px;
margin-top: 2rem;
margin-bottom: 1rem;
}
</style>
15 changes: 0 additions & 15 deletions docs/.vitepress/theme/AdComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,14 @@ import Icon from "./Icon.vue";
</template>

<style scoped>
@keyframes pulse {
0% {
border: 1px solid var(--vp-c-divider);
}
50% {
border: 1px solid var(--vp-c-brand);
}
100% {
border: 1px solid var(--vp-c-divider);
}
}
.ad-component {
text-align: center;
margin-bottom: 2rem;
padding: 0.5rem 0.85rem;
border: 2px solid var(--vp-c-brand);
border-radius: 4px;
text-decoration: none;
color: white;
transition: color 0.4s ease-in-out;
font-size: 1rem;
animation: pulse 3s infinite;
background-image: linear-gradient(to top right, #000000, #000842);
}
Expand Down
4 changes: 3 additions & 1 deletion docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import Theme from 'vitepress/theme'
import { h } from 'vue'
import '../style/vars.css'
import Theme from 'vitepress/theme'
import AdAsideComponent from './AdAsideComponent.vue'
import AdComponent from './AdComponent.vue'

export default {
...Theme,
Layout() {
return h(Theme.Layout, null, {
'doc-before': () => h(AdComponent),
'aside-outline-after': () => h(AdAsideComponent)
})
},
}
50 changes: 50 additions & 0 deletions docs/api/utils/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# events

The events module provides the `on` methods to listen to events from `pactum`.

Supported Events

- BEFORE_REQUEST
- AFTER_RESPONSE

## Syntax

```js
pactumEvents.on(event-type, callback);
```


## Usage

### ✅ Correct Usage

```js
pactumEvents.on(EVENT_TYPES.BEFORE_REQUEST, (ctx) => {
console.log(ctx);
});
```

## Arguments

#### > event-type (string)

Event type to listen to.

#### > callback (function)

Callback function to call when the event is triggered.

## Examples

### Listening to events

```js
const { pactumEvents, EVENT_TYPES } = require('pactum').events;

pactumEvents.on(EVENT_TYPES.BEFORE_REQUEST, (cxt) => {
console.log(cxt);
});
pactumEvents.on(EVENT_TYPES.AFTER_RESPONSE, (cxt) => {
console.log(cxt.response.body);
});
```

0 comments on commit 515ae39

Please sign in to comment.