Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 17:22:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 17:22:11 +0300
commit0c872e02b2c822e3397515ec324051ff540f0cd5 (patch)
treece2fb6ce7030e4dad0f4118d21ab6453e5938cdd /spec/frontend/feature_flags/components/strategy_label_spec.js
parentf7e05a6853b12f02911494c4b3fe53d9540d74fc (diff)
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'spec/frontend/feature_flags/components/strategy_label_spec.js')
-rw-r--r--spec/frontend/feature_flags/components/strategy_label_spec.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/spec/frontend/feature_flags/components/strategy_label_spec.js b/spec/frontend/feature_flags/components/strategy_label_spec.js
new file mode 100644
index 00000000000..c2d5ce10448
--- /dev/null
+++ b/spec/frontend/feature_flags/components/strategy_label_spec.js
@@ -0,0 +1,61 @@
+import { mount } from '@vue/test-utils';
+import StrategyLabel from '~/feature_flags/components/strategy_label.vue';
+
+const DEFAULT_PROPS = {
+ name: 'All Users',
+ parameters: 'parameters',
+ scopes: 'scope1, scope2',
+};
+
+describe('feature_flags/components/feature_flags_tab.vue', () => {
+ let wrapper;
+
+ const factory = (props = {}) =>
+ mount(
+ {
+ components: {
+ StrategyLabel,
+ },
+ render(h) {
+ return h(StrategyLabel, { props: this.$attrs, on: this.$listeners }, this.$slots.default);
+ },
+ },
+ {
+ propsData: {
+ ...DEFAULT_PROPS,
+ ...props,
+ },
+ },
+ );
+
+ describe('render', () => {
+ let strategyLabel;
+
+ beforeEach(() => {
+ wrapper = factory({});
+ strategyLabel = wrapper.findComponent(StrategyLabel);
+ });
+
+ it('should show the strategy label with parameters and scope', () => {
+ expect(strategyLabel.text()).toContain(DEFAULT_PROPS.name);
+ expect(strategyLabel.text()).toContain(DEFAULT_PROPS.parameters);
+ expect(strategyLabel.text()).toContain(DEFAULT_PROPS.scopes);
+ expect(strategyLabel.text()).toContain('All Users - parameters: scope1, scope2');
+ });
+ });
+
+ describe('without parameters', () => {
+ let strategyLabel;
+
+ beforeEach(() => {
+ wrapper = factory({ parameters: null });
+ strategyLabel = wrapper.findComponent(StrategyLabel);
+ });
+
+ it('should hide empty params and dash', () => {
+ expect(strategyLabel.text()).toContain(DEFAULT_PROPS.name);
+ expect(strategyLabel.text()).not.toContain(' - ');
+ expect(strategyLabel.text()).toContain('All Users: scope1, scope2');
+ });
+ });
+});