Skip to content
Snippets Groups Projects
Unverified Commit 297f1906 authored by Phil Hughes's avatar Phil Hughes
Browse files

Fixed failing specs

Added tests to file row truncated text computed prop
parent 5f299d85
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -53,8 +53,7 @@ describe('Diffs tree list component', () => {
fileHash: 'test',
key: 'index.js',
name: 'index.js',
path: 'index.js',
truncatedPath: '../index.js',
path: 'app/index.js',
removedLines: 0,
tempFile: true,
type: 'blob',
Loading
Loading
@@ -105,7 +104,7 @@ describe('Diffs tree list component', () => {
 
vm.$el.querySelector('.file-row').click();
 
expect(vm.$store.dispatch).toHaveBeenCalledWith('diffs/scrollToFile', 'index.js');
expect(vm.$store.dispatch).toHaveBeenCalledWith('diffs/scrollToFile', 'app/index.js');
});
 
it('renders as file list when renderTreeList is false', done => {
Loading
Loading
@@ -122,7 +121,7 @@ describe('Diffs tree list component', () => {
vm.renderTreeList = false;
 
vm.$nextTick(() => {
expect(vm.$el.querySelector('.file-row').textContent).toContain('../index.js');
expect(vm.$el.querySelector('.file-row').textContent).toContain('app/index.js');
 
done();
});
Loading
Loading
@@ -144,8 +143,7 @@ describe('Diffs tree list component', () => {
const blurEvent = new Event('blur');
vm.focusSearch = true;
 
vm
.$nextTick()
vm.$nextTick()
.then(() => {
vm.$el.querySelector('.form-control').dispatchEvent(blurEvent);
})
Loading
Loading
Loading
Loading
@@ -461,7 +461,6 @@ describe('DiffsStoreUtils', () => {
{
key: 'app',
path: 'app',
truncatedPath: 'app',
name: 'app',
type: 'tree',
tree: [
Loading
Loading
@@ -473,7 +472,6 @@ describe('DiffsStoreUtils', () => {
key: 'app/index.js',
name: 'index.js',
path: 'app/index.js',
truncatedPath: 'app/index.js',
removedLines: 10,
tempFile: false,
type: 'blob',
Loading
Loading
@@ -482,7 +480,6 @@ describe('DiffsStoreUtils', () => {
{
key: 'app/test',
path: 'app/test',
truncatedPath: 'app/test',
name: 'test',
type: 'tree',
opened: true,
Loading
Loading
@@ -495,7 +492,6 @@ describe('DiffsStoreUtils', () => {
key: 'app/test/index.js',
name: 'index.js',
path: 'app/test/index.js',
truncatedPath: 'app/test/index.js',
removedLines: 0,
tempFile: true,
type: 'blob',
Loading
Loading
@@ -509,7 +505,6 @@ describe('DiffsStoreUtils', () => {
key: 'app/test/filepathneedstruncating.js',
name: 'filepathneedstruncating.js',
path: 'app/test/filepathneedstruncating.js',
truncatedPath: '...est/filepathneedstruncating.js',
removedLines: 0,
tempFile: true,
type: 'blob',
Loading
Loading
@@ -523,7 +518,6 @@ describe('DiffsStoreUtils', () => {
{
key: 'package.json',
path: 'package.json',
truncatedPath: 'package.json',
name: 'package.json',
type: 'blob',
changed: true,
Loading
Loading
Loading
Loading
@@ -71,4 +71,40 @@ describe('RepoFile', () => {
 
expect(vm.$el.querySelector('.file-row-name').style.marginLeft).toBe('32px');
});
describe('outputText', () => {
beforeEach(done => {
createComponent({
file: {
...file(),
path: 'app/assets/index.js',
},
level: 0,
});
vm.displayTextKey = 'path';
vm.$nextTick(done);
});
it('returns text if truncateStart is 0', done => {
vm.truncateStart = 0;
vm.$nextTick(() => {
expect(vm.outputText).toBe('app/assets/index.js');
done();
});
});
it('returns text truncated at start', done => {
vm.truncateStart = 5;
vm.$nextTick(() => {
expect(vm.outputText).toBe('...ssets/index.js');
done();
});
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment