Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to test with local mag.js, or how to minify sources? #17

Open
pokehanai opened this issue Nov 29, 2015 · 10 comments
Open

How to test with local mag.js, or how to minify sources? #17

pokehanai opened this issue Nov 29, 2015 · 10 comments

Comments

@pokehanai
Copy link

I wrote a jasmine spec but failed to test it with local mag.js sources.

I modified specRunnder.html as

  <!-- script src="//rawgit.com/magnumjs/mag.js/master/mag.min.js"></script -->
  <script src="../src/fastdom.js"></script>
  <script src="../src/mag.js"></script>
  <script src="../src/fill.js"></script>
  <script src="../src/render.js"></script>
  <script src="../src/module.js"></script>
  <script src="../src/utils.js"></script>
  <script src="../src/mag.addons.0.2.js"></script>
  <script src="../src/mag.comps.js"></script>

then I got most strange error at the line

var flag, promise = mag.module("lister", mod)
// TypeError: promise.then is not a function

I wonder whether the minified js is same as those files.

Well, could you let me know how to test, or maybe the process to minify?

@magnumjs
Copy link
Owner

Hi there, I've been using plunker for dev/testing.

One thing is that the <script src="../src/mag.comps.js"></script> is deprecated with the latest code, so you can remove it.

Another thing is the specRunner is not on the latest code v0.2, it is still v0.1, so we need to create a new one for v0.2.

Check this out and look at the "build" test at the bottom of the preview page:

http://plnkr.co/edit/XSo9ocI7mgOHiErlXyw4?p=preview

Click the 'Nested - module - build' link and the textarea to the left will then contain the source code merged in order but not minified:

Copy the contents and paste it in here:
http://skalman.github.io/UglifyJS-online/
Then those results to here:
http://closure-compiler.appspot.com/
Then once again to here:
http://skalman.github.io/UglifyJS-online/

I hope that helps please let me know if you have any questions, thanks!

@pokehanai
Copy link
Author

Hi, thanks for reply.

I'm new to plunker; it looks nice. :)
But http://plnkr.co/edit/XSo9ocI7mgOHiErlXyw4?p=preview seems it does not run anything on my environment.

screen shot 2015-11-30 at 11 52 31 am

Environment: OS X Yosemite 10.10.5, Chrome 46.0.2490.86(64-bit) / Firefox 42.0

As I click 'Nested - module -build' link it opens a new tab window below.

Error: Not Found

The requested URL /js?file=http://run.plnkr.co/bQE5xSya9hb0BIiS/mag.js&file=http://run.plnkr.co/bQE5xSya9hb0BIiS/mod.js&file=http://run.plnkr.co/bQE5xSya9hb0BIiS/render.js&file=http://run.plnkr.co/bQE5xSya9hb0BIiS/mag-utils.js&file=http://run.plnkr.co/bQE5xSya9hb0BIiS/fill.js&file=http://run.plnkr.co/bQE5xSya9hb0BIiS/fastdom.js& was not found on this server.

Is it same what you see?

In the browser console window there is no errors.

On Chrome, the textarea remains "loading ..".
On Firefox it contains maybe concatenated code.

Do you have any idea?

@magnumjs
Copy link
Owner

Click it again, sometimes doesn't work on first click.

@pokehanai
Copy link
Author

Oh, I already did several times.
Reloaded the page, clicked stop and run repeatedly.
Installed Firefox newly this time and tried same things repeatedly.
Then all failed.

@magnumjs
Copy link
Owner

In chrome when I click the link once it opens the tab with the error, then I click the link again and the text area contains all the source code.

@pokehanai
Copy link
Author

I see, click the button twice.
I got the source this time. :)

@pokehanai
Copy link
Author

What about the tests in the page?
Are they runnable?

@magnumjs
Copy link
Owner

Yes they should be, just uncomment their source link in index.html

@pokehanai
Copy link
Author

Okay, I got it.
Thanks!

@magnumjs
Copy link
Owner

You're welcome, feel free to ask any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants