Commit 18b1f367 authored by Phil Hughes's avatar Phil Hughes
Browse files

removed useless v-if

removed pointless test & changed some deployment tests to make more sense
added in v-tooltip
parent 9e8df9ca2758
......@@ -119,16 +119,15 @@ export default {
</template>
<span
v-if="hasDeploymentTime"
:data-title="deployment.deployed_at_formatted"
v-tooltip
:title="deployment.deployed_at_formatted"
class="js-deploy-time"
data-toggle="tooltip"
data-placement="top"
>
{{ deployTimeago }}
</span>
<loading-button
v-if="deployment.stop_url"
container-class="btn btn-default btn-xs"
container-class="btn btn-default btn-xs prepend-left-default"
label="Stop environment"
:loading="isStopping"
@click="stopEnvironment"
......
......@@ -67,9 +67,6 @@ export default {
shouldRenderRelatedLinks() {
return !!this.mr.relatedLinks && !this.mr.isNothingToMergeState;
},
shouldRenderDeployments() {
return this.mr.deployments.length;
},
shouldRenderSourceBranchRemovalStatus() {
return !this.mr.canRemoveSourceBranch && this.mr.shouldRemoveSourceBranch &&
(!this.mr.isNothingToMergeState && !this.mr.isMergedState);
......@@ -251,7 +248,6 @@ export default {
:has-ci="mr.hasCI"
/>
<deployment
v-if="shouldRenderDeployments"
v-for="deployment in mr.deployments"
:key="deployment.id"
:deployment="deployment"
......
......@@ -748,10 +748,6 @@
> *:not(:last-child) {
margin-right: .3em;
}
.btn {
margin-left: $gl-padding;
}
}
.deploy-link {
......
......@@ -147,16 +147,26 @@ describe('Deployment component', () => {
el = vm.$el;
});
it('should render template elements correctly', () => {
expect(el.classList.contains('mr-widget-heading')).toEqual(true);
expect(el.querySelector('.js-icon-link')).not.toBeNull();
it('renders deployment name', () => {
expect(el.querySelector('.js-deploy-meta').getAttribute('href')).toEqual(deploymentMockData.url);
expect(el.querySelector('.js-deploy-meta').innerText).toContain(deploymentMockData.name);
});
it('renders external URL', () => {
expect(el.querySelector('.js-deploy-url').getAttribute('href')).toEqual(deploymentMockData.external_url);
expect(el.querySelector('.js-deploy-url').innerText).toContain(deploymentMockData.external_url_formatted);
});
it('renders stop button', () => {
expect(el.querySelector('.btn')).not.toBeNull();
});
it('renders deployment time', () => {
expect(el.querySelector('.js-deploy-time').innerText).toContain(vm.deployTimeago);
});
it('renders metrics component', () => {
expect(el.querySelector('.js-mr-memory-usage')).not.toBeNull();
expect(el.querySelector('button')).not.toBeNull();
});
});
});
......@@ -123,17 +123,6 @@ describe('mrWidgetOptions', () => {
expect(vm.shouldRenderSourceBranchRemovalStatus).toEqual(false);
});
});
describe('shouldRenderDeployments', () => {
it('should return false for the initial data', () => {
expect(vm.shouldRenderDeployments).toBeFalsy();
});
it('should return true if there is deployments', () => {
vm.mr.deployments.push({}, {});
expect(vm.shouldRenderDeployments).toBeTruthy();
});
});
});
describe('methods', () => {
......@@ -368,34 +357,6 @@ describe('mrWidgetOptions', () => {
});
});
describe('components', () => {
it('should register all components', () => {
const comps = mrWidgetOptions.components;
expect(comps['mr-widget-header']).toBeDefined();
expect(comps['mr-widget-merge-help']).toBeDefined();
expect(comps['mr-widget-pipeline']).toBeDefined();
expect(comps.Deployment).toBeDefined();
expect(comps['mr-widget-related-links']).toBeDefined();
expect(comps['mr-widget-merged']).toBeDefined();
expect(comps['mr-widget-closed']).toBeDefined();
expect(comps['mr-widget-merging']).toBeDefined();
expect(comps['mr-widget-failed-to-merge']).toBeDefined();
expect(comps['mr-widget-wip']).toBeDefined();
expect(comps['mr-widget-archived']).toBeDefined();
expect(comps['mr-widget-conflicts']).toBeDefined();
expect(comps['mr-widget-nothing-to-merge']).toBeDefined();
expect(comps['mr-widget-not-allowed']).toBeDefined();
expect(comps['mr-widget-missing-branch']).toBeDefined();
expect(comps['mr-widget-ready-to-merge']).toBeDefined();
expect(comps['mr-widget-checking']).toBeDefined();
expect(comps['mr-widget-unresolved-discussions']).toBeDefined();
expect(comps['mr-widget-pipeline-blocked']).toBeDefined();
expect(comps['mr-widget-pipeline-failed']).toBeDefined();
expect(comps['mr-widget-merge-when-pipeline-succeeds']).toBeDefined();
expect(comps['mr-widget-maintainer-edit']).toBeDefined();
});
});
describe('rendering relatedLinks', () => {
beforeEach((done) => {
vm.mr.relatedLinks = {
......
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