Commit f0bab9fb authored by Frédéric Caplette's avatar Frédéric Caplette

Merge branch 'nicolasdular/experiment-vue-component-rename' into 'master'

Rename experiment vue component

See merge request gitlab-org/gitlab!60444
parents a485d985 c0016efb
<script> <script>
import { GlEmptyState } from '@gitlab/ui'; import { GlEmptyState } from '@gitlab/ui';
import Experiment from '~/experimentation/components/experiment.vue'; import GitlabExperiment from '~/experimentation/components/gitlab_experiment.vue';
import { helpPagePath } from '~/helpers/help_page_helper'; import { helpPagePath } from '~/helpers/help_page_helper';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import PipelinesCiTemplates from './pipelines_ci_templates.vue'; import PipelinesCiTemplates from './pipelines_ci_templates.vue';
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
name: 'PipelinesEmptyState', name: 'PipelinesEmptyState',
components: { components: {
GlEmptyState, GlEmptyState,
Experiment, GitlabExperiment,
PipelinesCiTemplates, PipelinesCiTemplates,
}, },
props: { props: {
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
</script> </script>
<template> <template>
<div> <div>
<experiment name="pipeline_empty_state_templates"> <gitlab-experiment name="pipeline_empty_state_templates">
<template #control> <template #control>
<gl-empty-state <gl-empty-state
v-if="canSetCi" v-if="canSetCi"
...@@ -59,6 +59,6 @@ export default { ...@@ -59,6 +59,6 @@ export default {
<template #candidate> <template #candidate>
<pipelines-ci-templates /> <pipelines-ci-templates />
</template> </template>
</experiment> </gitlab-experiment>
</div> </div>
</template> </template>
...@@ -503,7 +503,7 @@ so you can use it when resolving some concepts around experimentation in the cli ...@@ -503,7 +503,7 @@ so you can use it when resolving some concepts around experimentation in the cli
### Use experiments in Vue ### Use experiments in Vue
With the `experiment` component, you can define slots that match the name of the With the `gitlab-experiment` component, you can define slots that match the name of the
variants pushed to `window.gon.experiment`. For example, if we alter the `pill_color` variants pushed to `window.gon.experiment`. For example, if we alter the `pill_color`
experiment to just use the default variants of `control` and `candidate` like so: experiment to just use the default variants of `control` and `candidate` like so:
...@@ -520,15 +520,15 @@ We can make use of the named slots `control` and `candidate` in the Vue componen ...@@ -520,15 +520,15 @@ We can make use of the named slots `control` and `candidate` in the Vue componen
```vue ```vue
<script> <script>
import Experiment from '~/experimentation/components/experiment.vue'; import GitlabExperiment from '~/experimentation/components/gitlab_experiment.vue';
export default { export default {
components: { Experiment } components: { GitlabExperiment }
} }
</script> </script>
<template> <template>
<experiment name="pill_color"> <gitlab-experiment name="pill_color">
<template #control> <template #control>
<button class="bg-default">Click default button</button> <button class="bg-default">Click default button</button>
</template> </template>
...@@ -536,7 +536,7 @@ export default { ...@@ -536,7 +536,7 @@ export default {
<template #candidate> <template #candidate>
<button class="bg-red">Click red button</button> <button class="bg-red">Click red button</button>
</template> </template>
</experiment> </gitlab-experiment>
</template> </template>
``` ```
...@@ -545,7 +545,7 @@ For example, the Vue component for the previously-defined `pill_color` experimen ...@@ -545,7 +545,7 @@ For example, the Vue component for the previously-defined `pill_color` experimen
```vue ```vue
<template> <template>
<experiment name="pill_color"> <gitlab-experiment name="pill_color">
<template #control> <template #control>
<button class="bg-default">Click default button</button> <button class="bg-default">Click default button</button>
</template> </template>
...@@ -557,7 +557,7 @@ For example, the Vue component for the previously-defined `pill_color` experimen ...@@ -557,7 +557,7 @@ For example, the Vue component for the previously-defined `pill_color` experimen
<template #blue> <template #blue>
<button class="bg-blue">Click blue button</button> <button class="bg-blue">Click blue button</button>
</template> </template>
</experiment> </gitlab-experiment>
</template> </template>
``` ```
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import ExperimentComponent from '~/experimentation/components/experiment.vue'; import ExperimentComponent from '~/experimentation/components/gitlab_experiment.vue';
const defaultProps = { name: 'experiment_name' }; const defaultProps = { name: 'experiment_name' };
const defaultSlots = { const defaultSlots = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment