Skip to content

Commit

Permalink
Revert "revert: this reverts commit b248723."
Browse files Browse the repository at this point in the history
This reverts commit 71285b4.
  • Loading branch information
crishellco committed Jun 27, 2024
1 parent 71285b4 commit 513c68c
Show file tree
Hide file tree
Showing 18 changed files with 3,745 additions and 3,294 deletions.
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p align="center"><a href="https://vue-hubble.crishell.co/" target="_blank" rel="noopener noreferrer"><img src="docs/src/.vuepress/public/assets/img/logo.png"></a><br></p>

<p align="center">
<img src="https://github.com/crishellco/vue-hubble/workflows/Build/badge.svg" alt="Build">
<img src="https://github.com/crishellco/vue-hubble/actions/workflows/node-ci.yml/badge.svg?branch=master" alt="Build">
<a href="https://codecov.io/gh/crishellco/vue-hubble"><img src="https://codecov.io/gh/crishellco/vue-hubble/branch/master/graph/badge.svg?token=IKcXpNL84k" alt="codecov"></a>
<a href="https://codeclimate.com/github/crishellco/vue-hubble/maintainability"><img src="https://api.codeclimate.com/v1/badges/e1f2536b9be3c32e6fef/maintainability" alt="Maintainability"></a>
<br>
Expand All @@ -17,15 +17,6 @@ about collisions, extraneous classes, etc.

Check out the [demo](http://vue-hubble-demo.crishell.co)

***

__NOTE__

This version works with __Vue 3.x and options API__ only.
Vue 3.x composition API support coming soon.

***

## Table of Contents

* [Documentation](#documentation)
Expand Down
1 change: 1 addition & 0 deletions demo/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
6 changes: 5 additions & 1 deletion demo/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<template>
<div id="app">
<img v-hubble="'image'" alt="Vue logo" src="./assets/logo.png" />
<hello-world />
<hello-world v-hubble="'hello-world'">
<buttons v-hubble="'buttons'" />
</hello-world>
</div>
</template>

<script>
import Buttons from './components/Buttons.vue';
import HelloWorld from './components/HelloWorld.vue';
export default {
Expand All @@ -14,6 +17,7 @@ export default {
hubble: 'parent',
components: {
Buttons,
HelloWorld,
},
};
Expand Down
26 changes: 26 additions & 0 deletions demo/src/components/Buttons.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<template>
<div>
<button v-hubble="'submit'">Submit</button>
<button v-hubble="'cancel'">Cancel</button>
</div>
</template>

<script>
export default {
name: 'Buttons',
setup() {
const hubble = 'buttons';
return {
hubble,
};
},
};
</script>

<style scoped>
button {
margin: 10px;
}
</style>
16 changes: 4 additions & 12 deletions demo/src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,13 @@
<div class="hello">
<h1 v-hubble="'header'">Hover over elements to see and copy selectors</h1>
<code v-hubble="'command'">$ yarn serve --mode test</code>
<div style="position: fixed; bottom: 0; right: 0; padding: 1rem">
<button v-hubble="'submit'">Submit</button>
</div>
<div style="position: fixed; bottom: 0; left: 0; padding: 1rem">
<button v-hubble="'cancel'">Cancel</button>
</div>

<slot />
</div>
</template>

<script>
export default {
name: 'DemoHelloWorld',
hubble: 'child',
};
<script setup>
const hubble = 'child';
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
Expand Down
1 change: 0 additions & 1 deletion demo/src/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// import Vue from 'vue';
import { createApp, h } from 'vue';

import App from './App.vue';
Expand Down
2,314 changes: 1,134 additions & 1,180 deletions demo/yarn.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
3 changes: 2 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
},
"scripts": {
"dev": "vuepress dev src",
"build": "vuepress build src -d dist"
"build": "cross-env NODE_OPTIONS=--openssl-legacy-provider vuepress build src -d dist"
},
"license": "MIT",
"devDependencies": {
"cross-env": "^7.0.3",
"vuepress": "1.9.10"
},
"dependencies": {
Expand Down
108 changes: 72 additions & 36 deletions docs/src/guide/namespacing.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,57 @@ ancestral namespaces.

### Example

#### Options API

```html
<!-- Form Component (child) -->
<template>
<div v-hubble="'attribute-selector'"></div>
</template>

<script>
export default {
hubble: {
namespace: 'form'
}
};
export default {
hubble: 'login'
};
</script>

<!-- Login Component (parent) -->
<template>
<form />
<Form />
</template>

<script>
export default {
components: {
Form
},
hubble: {
namespace: 'login'
}
/**
* Or shorthand...
* hubble: 'login'
**/
};
export default {
hubble: 'login',
components: {
Form
}
};
</script>

<div vue-hubble-selector="[vue-hubble][login--form--attribute-selector]" vue-hubble login--form--attribute-selector></div>
```

#### Composition API

```html
<!-- Form Component (child) -->
<template>
<div v-hubble="'attribute-selector'"></div>
</template>

<script setup>
const hubble = 'form';
</script>


<!-- Login Component (parent) -->
<template>
<Form />
</template>

<script setup>
const hubble = 'login';
</script>

<div vue-hubble-selector="[vue-hubble][login--form--attribute-selector]" vue-hubble login--form--attribute-selector></div>
Expand All @@ -60,38 +79,55 @@ component by using only it's own component namespace.

### Example

#### Options API

```html
<!-- Form Component (child) -->
<template>
<div v-hubble="'attribute-selector'"></div>
</template>

<script>
export default {
hubble: {
namespace: 'form'
}
};
export default {
hubble: 'login'
};
</script>

<!-- Login Component (parent) -->
<template>
<form />
<Form />
</template>

<script>
export default {
components: {
Form
},
hubble: {
namespace: 'login'
}
/**
* Or shorthand...
* hubble: 'login'
**/
};
export default {
hubble: 'login',
components: {
Form
}
};
</script>

<div vue-hubble-selector="[vue-hubble][form--attribute-selector]" vue-hubble form--attribute-selector></div>
```

#### Composition API
```html
<!-- Form Component (child) -->
<template>
<div v-hubble="'attribute-selector'"></div>
</template>

<script setup>
const hubble = 'form';
</script>

<!-- Login Component (parent) -->
<template>
<Form />
</template>

<script setup>
const hubble = 'login';
</script>

<div vue-hubble-selector="[vue-hubble][form--attribute-selector]" vue-hubble form--attribute-selector></div>
Expand Down
4 changes: 2 additions & 2 deletions docs/src/guide/plugin-options.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Plugin Options

| Name | Type | Default | Description |
| ------------------------ | ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|--------------------------|-------------------|---------|---------------------------------------------------------------------------------------------------------------------------------------|
| `defaultSelectorType` | `string` | `attr` | Defines the selector type if not passed into the directive `v-hubble:attr` |
| `enableComments` | `boolean` | `false` | Enables or disables comments around elements with hubble selectors |
| `enableDeepNamespacing` | `boolean` | `true` | Enables or disables auto recursive namespacing |
| `enableSelectorPicker` | `boolean` | `false` | Enables or disables the selector picker feature |
| `environment` | `string or array` | `test` | Defines the environment(s) in which these selectors are added |
| `environment` | `string or array` | `test` | Defines the environment(s) in which these selectors are added.<br /><br />**Note:** Use `*` for all environments. |
| `enableGroupedSelectors` | `boolean` | `true` | Enables or disables grouping the `vue-hubble-selector` attribute value with `[vue-hubble]` |
| `prefix` | `string` | `''` | Prefixes all selectors with the value and `--`, if value exists. For example, if `prefix = 'qa'`, all selectors well begin with`qa--` |
2 changes: 1 addition & 1 deletion docs/src/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Use the directive to add test selectors to elements you wish to test.

## Writing Tests

[Examples](https://github.com/crishellco/vue-hubble/blob/master/src/directive.spec.js)
[Examples](https://github.com/crishellco/vue-hubble/blob/master/plugin/src/directive.spec.js)

```javascript
describe('directive.js', () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ footer: MIT Licensed | Copyright © 2020-present Chris Mitchell
---

<p align="center">
<img src="https://github.com/crishellco/vue-hubble/workflows/Build/badge.svg" alt="Build">
<img src="https://github.com/crishellco/vue-hubble/actions/workflows/node-ci.yml/badge.svg?branch=master" alt="Build">
<a href="https://codecov.io/gh/crishellco/vue-hubble"><img src="https://codecov.io/gh/crishellco/vue-hubble/branch/master/graph/badge.svg?token=IKcXpNL84k" alt="codecov"></a>
<a href="https://codeclimate.com/github/crishellco/vue-hubble/maintainability"><img src="https://api.codeclimate.com/v1/badges/e1f2536b9be3c32e6fef/maintainability" alt="Maintainability"></a>
<br>
Expand Down
Loading

0 comments on commit 513c68c

Please sign in to comment.