Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: build
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm ci
- run: npm run build
- run: npm test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ obj
protos
*.temp
*.nupkg
*.yml
#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
Expand Down
6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ Once you've forked the F2 repository:

### Committing Changes

* You should only commit files you have changed. **Do not commit compiled or generated F2 files, except:**
* If you've modified any file in the `/src/` directory, you must commit `/dist/f2.js` for the [Travis unit tests](https://travis-ci.org/OpenF2/F2).
* You should only commit files you have changed. **Do not commit compiled or generated F2 files**
* After you've staged your changes, add a detailed commit message.
* Push committed changes to your fork's branch.
* [Submit a pull request](https://help.github.com/articles/using-pull-requests) for `F2\*-wip` **not** `F2\master`.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Join the team and help contribute to F2 on GitHub. Begin by reading our [contrib

**Thank you to the [growing list of contributors](https://github.com/OpenF2/F2/graphs/contributors)!**

## Developers [![Build Status](https://travis-ci.org/OpenF2/F2.svg?branch=master)](https://travis-ci.org/OpenF2/F2) [![Slack](https://openf2-slack.herokuapp.com/badge.svg)](https://openf2.slack.com)
## Developers [![Build Status](https://github.com/openf2/f2/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/OpenF2/F2/actions) [![Slack](https://openf2-slack.herokuapp.com/badge.svg)](https://openf2.slack.com)

### Get F2.js

Expand Down
1 change: 0 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
".gitignore",
".gitattributes",
".jshintrc",
".travis.yml",
"Gruntfile.js",
"package.json",
"README.md",
Expand Down
2 changes: 1 addition & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Testing F2 [![Build Status](https://travis-ci.org/OpenF2/F2.png?branch=master)](https://travis-ci.org/OpenF2/F2)
### Testing F2 [![Build Status](https://github.com/openf2/f2/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/OpenF2/F2/actions)

F2 tests are built with the behavior-driven framework [Jasmine](https://jasmine.github.io/). The test can be run via `npm test` or can be run in a browser by running `npm run test-live`. [Karma](https://karma-runner.github.io/) is used to assist with executing the tests in a browser (real or headless).

Expand Down
307 changes: 307 additions & 0 deletions tests/apps/com_openf2_examples_nodejs_helloworld/highcharts-4.0.3.js

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions tests/spec/app-handlers-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ describe('F2.AppHandlers', function () {

var containerAppHandlerToken = null;

beforeEachReloadF2(function () {
beforeEach(function () {
if (F2.AppHandlers.getToken) {
containerAppHandlerToken = F2.AppHandlers.getToken();
}
Expand Down Expand Up @@ -57,7 +57,7 @@ describe('F2.AppHandlers', function () {
});

it('F2.AppHandlers.getToken() method should be destroyed after first call.', function () {
// F2.AppHandlers.getToken is called above in the beforeEachReloadF2
// F2.AppHandlers.getToken is called above in the beforeEach
expect(F2.AppHandlers.getToken).toBeFalsy();
});

Expand Down Expand Up @@ -139,7 +139,7 @@ describe('F2.AppHandlers - rendering - appCreateRoot', function () {

var containerAppHandlerToken = null;

beforeEachReloadF2(function () {
beforeEach(function () {
if (F2.AppHandlers.getToken) {
containerAppHandlerToken = F2.AppHandlers.getToken();
}
Expand Down Expand Up @@ -371,7 +371,7 @@ describe('F2.AppHandlers - rendering - appRenderBefore', function () {

var containerAppHandlerToken = null;

beforeEachReloadF2(function () {
beforeEach(function () {
if (F2.AppHandlers.getToken) {
containerAppHandlerToken = F2.AppHandlers.getToken();
}
Expand Down Expand Up @@ -608,7 +608,7 @@ describe('F2.AppHandlers - rendering - appRender', function () {

var containerAppHandlerToken = null;

beforeEachReloadF2(function () {
beforeEach(function () {
if (F2.AppHandlers.getToken) {
containerAppHandlerToken = F2.AppHandlers.getToken();
}
Expand Down Expand Up @@ -954,7 +954,7 @@ describe('F2.AppHandlers - rendering - appRenderAfter', function () {

var containerAppHandlerToken = null;

beforeEachReloadF2(function () {
beforeEach(function () {
if (F2.AppHandlers.getToken) {
containerAppHandlerToken = F2.AppHandlers.getToken();
}
Expand Down Expand Up @@ -1068,7 +1068,7 @@ describe('F2.AppHandlers - rendering - appRenderAfter', function () {
describe('F2.AppHandlers - rendering - appDestroyBefore', function () {
var containerAppHandlerToken = null;

beforeEachReloadF2(function () {
beforeEach(function () {
if (F2.AppHandlers.getToken) {
containerAppHandlerToken = F2.AppHandlers.getToken();
}
Expand Down Expand Up @@ -1189,7 +1189,7 @@ describe('F2.AppHandlers - rendering - appDestroy', function () {

var containerAppHandlerToken = null;

beforeEachReloadF2(function () {
beforeEach(function () {
containerAppHandlerToken = F2.AppHandlers.getToken();
});

Expand Down Expand Up @@ -1379,7 +1379,7 @@ describe('F2.AppHandlers - rendering - appDestroy', function () {
describe('F2.AppHandlers - rendering - appDestroyAfter', function () {
var containerAppHandlerToken = null;

beforeEachReloadF2(function () {
beforeEach(function () {
if (F2.AppHandlers.getToken) {
containerAppHandlerToken = F2.AppHandlers.getToken();
}
Expand Down Expand Up @@ -1498,7 +1498,7 @@ describe('F2.AppHandlers - error handling - appScriptLoadFailed', function () {

var containerAppHandlerToken = null;

beforeEachReloadF2(function () {
beforeEach(function () {
if (F2.AppHandlers.getToken) {
containerAppHandlerToken = F2.AppHandlers.getToken();
}
Expand Down
18 changes: 14 additions & 4 deletions tests/spec/autoload-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ describe('F2.loadPlaceholders - auto', function() {
// sum the number of children found in each of the elements that were found
children = Array.from(element).reduce((total, current) => total + current.children.length, 0);
if (children === count) {
expect(children).toEqual(count);
clearInterval(periodicCheck);
try {
expect(children).toEqual(count);
} catch (e) {
console.error('caught exception waiting for children: ' + e.message);
} finally {
clearInterval(periodicCheck);
}
done();
}
},
Expand Down Expand Up @@ -262,8 +267,13 @@ describe('F2.loadPlaceholders - manual', function() {
// sum the number of children found in each of the elements that were found
children = Array.from(element).reduce((total, current) => total + current.children.length, 0);
if (children === count) {
expect(children).toEqual(count);
clearInterval(periodicCheck);
try {
expect(children).toEqual(count);
} catch (e) {
console.error('caught exception waiting for children: ' + e.message);
} finally {
clearInterval(periodicCheck);
}
done();
}
}, 100);
Expand Down
50 changes: 22 additions & 28 deletions tests/spec/container-spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
describe('F2.registerApps - pre-load', function() {

beforeEachReloadF2(function() {
beforeEach(function() {
spyOn(console, 'log').and.callThrough();
// refresh the preloaded apps since the F2/F2.Apps namespace was wiped out
window.F2_PRELOADED.forEach(f => f());
});
afterEachDeleteTestScripts();

it('should throw exception if F2.init() is not called prior', function() {
var appConfig = {
Expand Down Expand Up @@ -145,8 +144,6 @@ describe('F2.registerApps - pre-load', function() {

describe('F2.init', function() {

beforeEachReloadF2();

it('should allow for no parameters', function() {
expect(function() {
F2.init();
Expand All @@ -163,8 +160,6 @@ describe('F2.init', function() {

describe('F2.init - xhr overrides', function() {

beforeEachReloadF2();

it('should throw an exception when ContainerConfig.xhr is not an object or function', function() {
expect(function() {
F2.init({
Expand Down Expand Up @@ -208,8 +203,6 @@ describe('F2.init - xhr overrides', function() {

describe('F2.isInit', function() {

beforeEachReloadF2();

it('should return false when F2.init has not been called', function() {
expect(F2.isInit()).toBeFalsy();
});
Expand All @@ -222,9 +215,6 @@ describe('F2.isInit', function() {

describe('F2.init - internationalization', function() {

beforeEachReloadF2();
afterEachDeleteTestScripts();

var appConfig = {
appId: TEST_APP_ID,
manifestUrl: TEST_MANIFEST_URL,
Expand Down Expand Up @@ -502,8 +492,6 @@ describe('F2.registerApps - basic', function() {

describe('F2.registerApps - xhr overrides', function() {

beforeEachReloadF2();

var appConfig = {
appId: TEST_APP_ID,
manifestUrl: TEST_MANIFEST_URL
Expand Down Expand Up @@ -654,9 +642,6 @@ describe('F2.registerApps - xhr overrides', function() {

describe('F2.registerApps - rendering', function() {

beforeEachReloadF2();
afterEachDeleteTestScripts();

var appConfig = {
appId: TEST_APP_ID,
manifestUrl: TEST_MANIFEST_URL
Expand Down Expand Up @@ -710,12 +695,15 @@ describe('F2.registerApps - rendering', function() {

it('should add cache buster to AppManifest.scripts when F2.ContainerConfig.debugMode is true', function(done) {

var scriptGuid = F2.guid();
var scriptRegex = new RegExp('guid=' + scriptGuid);

F2.checkCacheBuster = function() {
var bustedCache = false;
var scripts = document.querySelectorAll('script');

for (var i = 0; i < scripts.length; i++) {
if (/appclass.js\?cachebuster/.test(scripts[i].src)) {
if (scriptRegex.test(scripts[i].src)) {
bustedCache = true;
break;
}
Expand All @@ -733,20 +721,24 @@ describe('F2.registerApps - rendering', function() {
manifestUrl: TEST_MANIFEST_URL
}], [{
'inlineScripts': ['(function() {F2.checkCacheBuster();})()'],
'scripts': [appClass],
'scripts': [appClass + '?guid=' + scriptGuid],
'apps': [{
'html': '<div class="test-app-2">Testing</div>'
}]
}]);
});

it('should not add cache buster to AppManifest.scripts when F2.ContainerConfig.debugMode is undefined or false', function(done) {

var scriptGuid = F2.guid();
var scriptRegex = new RegExp('guid=' + scriptGuid);

F2.checkCacheBuster = function() {
var bustedCache = false;
var scripts = document.querySelectorAll('script');

for (var i = 0; i < scripts.length; i++) {
if (/appclass.js/.test(scripts[i].src)) {
if (scriptRegex.test(scripts[i].src)) {
bustedCache = /cachebuster/.test(scripts[i].src);
break;
}
Expand All @@ -762,7 +754,7 @@ describe('F2.registerApps - rendering', function() {
manifestUrl: TEST_MANIFEST_URL
}], [{
'inlineScripts': ['(function() {F2.checkCacheBuster();})()'],
'scripts': [appClass],
'scripts': [appClass + '?guid=' + scriptGuid],
'apps': [{
'html': '<div class="test-app-2">Testing</div>'
}]
Expand All @@ -775,6 +767,7 @@ describe('F2.registerApps - rendering', function() {
F2.init();

F2.Events.on('com_openf2_examples_nodejs_helloworld-init', () => {
console.log('event received');
appsInitialized++;
if (appsInitialized === 3) {
expect(appsInitialized).toBe(3);
Expand Down Expand Up @@ -804,25 +797,26 @@ describe('F2.registerApps - rendering', function() {

F2.init();

//load 1 app with 2 script files, the 2nd one defines F2.HightChartsIsDefined global.
//notify when dependencies have been loaded
F2.Events.on('com_openf2_examples_nodejs_helloworld-init', data => {
console.log('init event received');
expect(data.HightChartsIsDefined).toBeTruthy();
done();
});

//load 1 app with 2 script files, the 2nd one depends on Highcharts
F2.registerApps([{
appId: TEST_APP_ID3,
manifestUrl: TEST_MANIFEST_URL3
}], [{
'scripts': [
'https://cdnjs.cloudflare.com/ajax/libs/highcharts/4.0.3/highcharts.js',
'http://localhost:8080/tests/apps/com_openf2_examples_nodejs_helloworld/highcharts-4.0.3.js',
'http://localhost:8080/tests/apps/com_openf2_examples_nodejs_helloworld/appclass.js'
],
'apps': [{
'html': '<div class="test-app-1">Testing</div>'
}]
}]);

//notify when dependencies have been loaded
F2.Events.on('com_openf2_examples_nodejs_helloworld-init', data => {
expect(data.HightChartsIsDefined).toBeTruthy();
done();
});
});

});
Loading