-
Notifications
You must be signed in to change notification settings - Fork 310
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
Rewrite in ES6 using webpack #511
base: master
Are you sure you want to change the base?
Conversation
I'm trying to address the |
After spending some more time with the code, I think we have 2 options: add an extra property to the rivets factory in |
Having a hard time researching how to elegantly integrate a babel compiler as part of the |
@Leeds-eBooks sorry to barge in. I use karma with mocha for ES6/babel in projects at work. For my side projects I use a module loader I created that you can hook babel directly into, and run in the browser/phantomjs, which runs mocha directly; no Karma. Karma is a good alternative. |
@MiguelCastillo Your module loader sounds intriguing. Is it public? |
Yeah, it is public. https://github.com/MiguelCastillo/bit-imports. The example is all written in ES2015 and transpiled in the browser. I can perhaps create a quick scaffold for bit-imports/babel/mocha, if you are interested. |
Here are some unit tests using with bit-imports/mocha that run in the browser/phantomjs... https://github.com/MiguelCastillo/bit-imports/tree/master/test If you want to see a unit test setup with multiple module types running, check this one out. |
@MiguelCastillo so how would we go about setting this up for the rivets tests? If I understand your docs correctly, we load bit-imports in a regular script tag in the |
@Leeds-eBooks Yup, broad strokes that's correct. Load bit-imports and System.import specrunner. There are a few steps in between that I am writing a recipe for. I will send out a link a little later when it's ready. In the meantime, if you want to see a setup that's running this unit test setup, take a look here. No instruction on what the moving pieces are, and that's what I am writing as a recipe for you today. If I have time today, I will fork rivets and do a setup in for this branch.
|
Hi everyone, I've just pushed a commit that gets the There are now just 3 tests failing. They have me stumped, for now. |
I have added some logs to my local repo to try and work out what's going with the it("lets you push an item", function() {
var view = rivets.bind(fragment, model);
var originalLength = model.items.length;
// one child for each element in the model plus 1 for the comment placeholder
Should(fragment.childNodes.length).be.exactly(model.items.length + 1);
console.log(model.items.length); // LOGS: 3
console.log(model.items.map(function(x) {return typeof x + " " + x;})); // LOGS: ["object [object Object]","object [object Object]","object [object Object]"]
model.items.push({"val": 3});
console.log(model.items.map(function(x) {return typeof x + " " + x;})); // LOGS: ["object [object Object]","object [object Object]","object [object Object]","object [object Object],[object Object],[object Object],,push","string push"]
console.log(model.items.length); // LOGS: 5
Should(model.items.length).be.exactly(originalLength + 1);
Should(fragment.childNodes.length).be.exactly(model.items.length + 1);
}); So after |
If you feel that this branch is ready to merge, I can install this branch in a big project to check if there are any breaking changes. |
@jhnns Thanks man, but until all tests are passed, I don't think it's worth it, as they are testing for basic functionality and failing tests to me mean a broken rivets. Do you have any insight into this specific problem? There are only 3 tests that we still failing and I'm banging my head against a brick wall trying to fix them... There's something weird going on with the each binder and mutation of the input array but I can't trace the source of the issue. |
@Leeds-eBooks I'm suspecting line 56 in adapter.js is misbehaving. This is the line in charge of pushing the elements to the array. Since the wrapping function is an arrow function you can not use the |
@ydaniv Ah thanks man, but I spotted that one and it doesn't fix the problem. Weird that it wasn't causing any failing tests. Anyway I'll push that fix today. But still completely stuck on this! |
…eves the incorrect context, and therfore had no observer when the binding publishes.
…eves the incorrect context, and therefore had no observer when the binding publishes.
@Duder-onomy I'm still getting 3 failing tests, under EDIT: forgot to run build :P great work! |
…_ES6 Report regexp to split formatters. Fixed #432
Report on ES6 branch : generated index for nested rv-each. Docs included
Don't use view.els.forEach to avoid exception when jquery is used
Report PR #546 on ES6 branch
Got ES6 Travis build working + Updated Webpack & Babel
added test and report fix from #655
…d-attributes Fix/camelcase components dashed attributes
…tribute-ES6 Report Fix uncorrect '0' receive by binders if html attribute is not …
…s to be already effective on ES6 branch
Report fix for #644 on ES6. Only the test has been reported, fix seem…
Report fix for #650
Report #619. It's only a test, actual fix is on sightglass 0.2.6
This branch converts the codebase from CoffeeScript to ES6, and replaces previous gulp tasks with webpack only. It still needs a lot of attention before it can be considered stable and merged in.
Todo
(Added by @Leeds-eBooks on 23 Aug 15):
(Added by @Leeds-eBooks on 26 Jan 16):