Skip to content

Commit

Permalink
bugy#281 improved long loading wording
Browse files Browse the repository at this point in the history
  • Loading branch information
bugy authored and antonellocaroli committed Aug 1, 2020
1 parent 673d22b commit 24da2c9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
6 changes: 4 additions & 2 deletions web-src/src/main-app/components/scripts/ScriptLoadingText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
}
if (this.counter === 30) {
this.loadingDots += ' I give up :(';
this.loadingDots += ' loading time is unknown';
return;
}
Expand All @@ -66,7 +66,7 @@
continue;
}
this.loadingDots += ' ' + phrase + ' ..'
this.loadingDots += ' ' + phrase + ' ..';
return;
}
}
Expand Down Expand Up @@ -105,6 +105,8 @@
'doing my best',
'don\'t leave me',
'thanks for waiting',
'Zzzzz',
'42',
'I\'m still alive',
'what a lovely weather today',
'some bits got stuck',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ describe('Test ScriptLoadingText', function () {
describe('Test dynamic loading text', function () {

it('test initial text', async function () {
loadingText.setProps({loading: true, delay: 1000})
loadingText.setProps({loading: true, delay: 1000});

await vueTicks()
await vueTicks();

expect(loadingText.text()).toBe('Loading ..');
});
Expand All @@ -43,9 +43,9 @@ describe('Test ScriptLoadingText', function () {
return 3;
});

loadingText.setProps({loading: true})
loadingText.setProps({loading: true});

await timeout(DEFAULT_DELAY * 10 + 50)
await timeout(DEFAULT_DELAY * 10 + 50);

expect(loadingText.text()).toStartWith('Loading ....... thanks for waiting ...');
});
Expand All @@ -56,50 +56,50 @@ describe('Test ScriptLoadingText', function () {
return counter++;
});

loadingText.setProps({loading: true})
loadingText.setProps({loading: true});

await timeout(DEFAULT_DELAY * 20 + 50)
await timeout(DEFAULT_DELAY * 20 + 50);

expect(loadingText.text()).toStartWith('Loading ....... wait a bit more ........ doing my best ..');
});

it('test full text', async function () {
let counter = 8;
let counter = 10;
rewireRandomInt(() => {
return counter--;
});

loadingText.setProps({loading: true})
loadingText.setProps({loading: true});

await timeout(DEFAULT_DELAY * 40 + 50)
await timeout(DEFAULT_DELAY * 40 + 50);

expect(loadingText.text()).toBe(
'Loading ....... almost done ........ patience is power ......... '
+ 'some bits got stuck .......... I give up :(');
+ 'some bits got stuck .......... loading time is unknown');
});

it('test reset after script change', async function () {
loadingText.setProps({loading: true})
await timeout(DEFAULT_DELAY * 5)
loadingText.setProps({loading: true});
await timeout(DEFAULT_DELAY * 5);

loadingText.setProps({script: 'script 2', delay: 1000})
loadingText.setProps({script: 'script 2', delay: 1000});

await vueTicks()
await vueTicks();

expect(loadingText.text()).toBe('Loading ..');
});

it('test reset after script change twice', async function () {
loadingText.setProps({loading: true})
await timeout(DEFAULT_DELAY * 5)
loadingText.setProps({loading: true});
await timeout(DEFAULT_DELAY * 5);

loadingText.setProps({script: 'script 2', delay: 1})
loadingText.setProps({script: 'script 2', delay: 1});

await timeout(20)
await timeout(20);

loadingText.setProps({script: 'script 3', delay: 1000})
loadingText.setProps({script: 'script 3', delay: 1000});

await vueTicks()
await vueTicks();

expect(loadingText.text()).toBe('Loading ..');
});
Expand Down

0 comments on commit 24da2c9

Please sign in to comment.