These are chat archives for bvaughn/forms-js

5th
Apr 2015
Brian Vaughn
@bvaughn
Apr 05 2015 00:15
Btw, I split out the examples/*.html files into separate files, per directive, to better enable our Protractor tests (assuming we figure out how to get around the current annoying sync-timeout issue)
Mohsen Azimi
@mohsen1
Apr 05 2015 00:56
Brian I’m looking at 1x code. It seems that wr’re assuming view is always provided. Is view a required parameter for FormsJS?
Brian Vaughn
@bvaughn
Apr 05 2015 05:21
No, we're not.
If you check out some of the examples/*.html files you'll see that manual markup is supported. view is totally optional.
fjsView directive uses it
Brian Vaughn
@bvaughn
Apr 05 2015 05:43
Huzzah! I found a (hacky) workaround for our Protractor tests :)
I'll commit some actual, working tests here in a few :) exciting
Brian Vaughn
@bvaughn
Apr 05 2015 05:48
Check it out - this HTML example - https://github.com/forms-js/angular-1x/blob/master/examples/radio.html - provides a test harness AND powers our Protractor tests - https://github.com/forms-js/angular-1x/blob/master/tests/integration/radio.js
Nice! :D
Mohsen Azimi
@mohsen1
Apr 05 2015 14:59
Cool. I'm looking at angular1x code to see how can I steal some your work for web components
I made this change but TypeScript is complaining. Doesn't TypeScript support computed properties?
diff
```diff
diff --git a/source/utils/input-helpers.ts b/source/utils/input-helpers.ts
index 378b419..c5b2a8c 100644
--- a/source/utils/input-helpers.ts
+++ b/source/utils/input-helpers.ts
@@ -28,12 +28,10 @@ module adaptor.utils {
             if (typeof option === "object") {
               bindableOptions.push(option);
             } else {
-              var bindableOption = {};
-              bindableOption[$scope.displayAttribute] = option;
-              bindableOption[$scope.valueAttribute] = option;
-
-              bindableOptions.push(bindableOption);
-            }
+              bindableOptions.push({
+                [$scope.displayAttribute]: option,
+                [$scope.valueAttribute]: option
+              });
           });
         }
oops my bad. I was missing the closing }
Mohsen Azimi
@mohsen1
Apr 05 2015 15:08
made a lame PR for that change forms-js/angular-1x#6
Brian Vaughn
@bvaughn
Apr 05 2015 15:56
No ~ Microsoft/TypeScript#1811
So that PR should probably just get closed for now unfortunately.
I'm eager to check out the web components stuff. :)
Been kind of holding off until you say you have something to show
Mohsen Azimi
@mohsen1
Apr 05 2015 19:10
By no you mean TypeScript doesnt support computed properties?
For web component we need to add polymer as a dependency. The component itself would not require polymer but will use it internally.
I'm still not super clear how should I use formjs. I need spend more time reviewing 1x code
Brian Vaughn
@bvaughn
Apr 05 2015 20:30
TypeScript does not support computed properties. No. I linked to the open issue they have to spec out how difficult it would be to add support, but it hasn't even been started from what I see.
What are you unclear on?
I will offer, again, to talk through it if you would like.
Brian Vaughn
@bvaughn
Apr 05 2015 20:43
Looks like what's really not supported (yet) deals more with type-checking for computed properties.
But...I still think the browser support is so poor for that feature that we should avoid it.
David Jensen
@davidlgj
Apr 05 2015 20:44
Hi guys, sorry for dropping of totally this week and weekend, work has been... well, let's call it interesting and a bit much. At the same time one of my kids got the flue. Anyway I read back all that I missed here :) I'm gonna check out what you done on the 1.x branch Brian, you did right to merge it. I am a bit concerned though on how much time I will have to put on this, I might have bitten more than I can chew :(
Mohsen Azimi
@mohsen1
Apr 05 2015 20:45
I'm traveling today. I will ping you when I arrived home tonight. If you were online we can talk
Brian Vaughn
@bvaughn
Apr 05 2015 20:48
Sounds good Mohsen. Sorry to hear you're having a busy week and a sick kid David.
Wonder if we should try to recruit any other help? This undertaking might be a bit too large/ambitious for our dwindling numbers.
David Jensen
@davidlgj
Apr 05 2015 20:52
Yeah, that might be a good idea. I like to help and do stuff but a terrible week and sick kids is sadly not an outlier for me.
What I'm saying is that I probably should do smaller issues when I can, or grab stuff when I know I have time to spend.
Sorry :(
Brian Vaughn
@bvaughn
Apr 05 2015 20:54
Do any of you know anyone promising?
David Jensen
@davidlgj
Apr 05 2015 20:55
Not at the top of my head.. No.
Brian Vaughn
@bvaughn
Apr 05 2015 20:55
Eh, shit happens. I'd just hate to see the time and effort invested so far go to waste. I feel like we've got a strong start.
David Jensen
@davidlgj
Apr 05 2015 20:57
:)
Brian Vaughn
@bvaughn
Apr 05 2015 20:59
Too many promising projects go unused.
Task Runner was another effort I poured a few weeks worth of time into and...nothing came from it. lol
Maybe I need new hobbies
David Jensen
@davidlgj
Apr 05 2015 21:00
Well, you only need one hit, you know.
Looking through your code right now, looks clean and nice!
Going to try out the protractor tests
Brian Vaughn
@bvaughn
Apr 05 2015 21:06
Thanks David. I'm pretty pleased at getting the Protractor tests up and running. Makes me think I should have (or maybe still should) go back and add similar tests to formFor.
David Jensen
@davidlgj
Apr 05 2015 21:22
lol the tests run on on npm install... before you got a server up and running! So they all fail
Works like a charm when the server is up though :)
Looks really good with material design btw
Brian Vaughn
@bvaughn
Apr 05 2015 21:27
Haha, ah...haven't run npm install in a while, just been running them via gulp test
Thx
David Jensen
@davidlgj
Apr 05 2015 21:35
There is one thing I've been thinking of. Recently we decided to build a largish admin page in one giant angular schema form form, i.e one JSON Schema and one form definition list (what we call view schema), it's something like 3000 rows of indented JSON data in total. This works well, with just one hitch: It takes 12s to render. I finally tracked down the culprit yesterday, it's that I do a manual $compile of a template in the directive for each field instead of having a template. So the solution is to do a total rewrite of the "building" part of angular schema form and try to up front render as much html as possible. I'm hoping to leverage transclusion to keep it clean though. Anyway the reason I'm writing this is that I'm going to be needing to do this soonish, and I figure there might be some overlap here with formsjs view "building" parts. Does that sound interesting?
Brian Vaughn
@bvaughn
Apr 05 2015 21:38
Of course. :)
David Jensen
@davidlgj
Apr 05 2015 21:40
I'm going to do a small prototype first, just to iron out the how, and to test that it is indeed faster. Maybe I can show you guys that and we can have a discussion about it :)
Brian Vaughn
@bvaughn
Apr 05 2015 21:42
:) k
David Jensen
@davidlgj
Apr 05 2015 21:44
Got to go! bye
Mark Chapman
@mchapman
Apr 05 2015 22:01
Damn. I missed David. My apologies are down to me being ill, and my kids being on holiday. But I have been preparing to try and incorporate forms-js into forms-angular by converting that to Typsecript. If you can think of anything you would prefer to see me doing let me know. I have about 3 days work before I go on holiday for 10 days.
(and 3 days of my work seems to be about 40 minutes of yours)
Brian Vaughn
@bvaughn
Apr 05 2015 22:05
You're thinking about updating forms-angular to use forms-js base library? That would be exciting.
Mark Chapman
@mchapman
Apr 05 2015 22:07
You missed the very significant "try" word! The Typescript thing is useful anyway. But yes, I hope that might be possible - would certainly be a test of it.
Brian Vaughn
@bvaughn
Apr 05 2015 22:10
:) Yes it would.
Mark Chapman
@mchapman
Apr 05 2015 22:14
There is a lot of work to do just to get to the point where it actually starts though - converting mongo schemas into validation / view schemas (I was looking at that yesterday and wondering why does our validation not have a basic type - is that up for discussion?) and then handling the submission of the data etc. All quite non trivial for someone of my meagre skills
Brian Vaughn
@bvaughn
Apr 05 2015 22:42
Our validation has a type.
It has an input type and a validation type
Validation type is reasonably well tested too.
Mark Chapman
@mchapman
Apr 05 2015 22:44
I just saw that there wasn't one in https://github.com/forms-js/angular-1x/blob/master/examples/builder.html and thought you may have moved it into view. I didn't look any closer at the time
(Cos I was playing with Protractor)
Brian Vaughn
@bvaughn
Apr 05 2015 22:45
That particular example HTML is pretty sparce.
*sparse
As is the Builder in general.
Is currently just passes through all attributes.
Although to be fair, the builder really only cares about the inputType (view schema) not the validation type.
The validation is all up to forms-js base library to handle.
If you'd like any help in the migration, feel free to reach out :)
I've thought (and still think) about migrating formFor to make use of forms-js also, but...I haven't done it yet. :)
Mark Chapman
@mchapman
Apr 05 2015 22:47
I wouldn't want to inflict grappling with my code on anyone!
Brian Vaughn
@bvaughn
Apr 05 2015 22:47
I'd probably want to create some robust Protractor tests first.
Hah, well even if you just need to ask a question for clarity or whatever.
Mark Chapman
@mchapman
Apr 05 2015 22:48
I have pretty robust Protractor tests. Even screen compares
Brian Vaughn
@bvaughn
Apr 05 2015 22:48
That's fantastic.
Mark Chapman
@mchapman
Apr 05 2015 22:48
Well, I only put them in after I did something very un-fantastic!
Brian Vaughn
@bvaughn
Apr 05 2015 22:49
Adding them to formFor would be a bit of a pain in the ass, given it has 3 significantly different template libraries.
Mark Chapman
@mchapman
Apr 05 2015 22:51
Not sure it would. forms-angular has 3 as well. Didn't take me as long as I thought. https://github.com/forms-angular/website/tree/master/test/screen_tests will give you a start.
and then you can compare with something like http://www.akikoskinen.info/image-diffs-with-git/
But you are less likely to shoot yourself in the foot than me, as you use sensible templates rather than spitting out HTML direct from a directive
Brian Vaughn
@bvaughn
Apr 05 2015 22:54
Ah, screenshot compares, yeah. I was thinking more along the lines of Protractor tests to verify initial state and changes to state.
That seems...more complicated, because the DOM structure (and thus the Protractor statements) would vary between the 3 templates. Seems like it would require a lot of (admittedly simple) code.
Guess I could create a facade to set between a reusable Protractor test and each of the templates add-ons to abstract the differences in the DOM..