Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Remove name attribute radio inputs inside cloned nodes by dd-proxy (Fix #1663) #1666

Merged
merged 3 commits into from

4 participants

@jbalsas

This is a possible fix for #1663.

When cloning a node, removing the name attribute from any inputs of type radio inside the dragged node, will prevent them from unchecking the selected radio button on its group.

I've added a test to verify this. Somehow it works properly when launched with yeti, but fails to pass when launched via yogi. Am I missing something here?

I've also created a demo with the working fix

@jbalsas

This is the yeti report when running the dd tests:

  Agent connected: Internet Explorer (8.0) / Windows XP 64 from XXX.XX.XX.XX
  Agent connected: Firefox (27.0) / Windows XP 64 from XXX.XX.XX.XX
  Agent connected: Chrome (23.0.1271.97) / Windows XP 64 from XXX.XX.XX.XX
✓ Testing started on Internet Explorer (8.0) / Windows XP 64, Firefox (27.0) / Windows XP 64, Chrome (23.0.1271.97) / Windows XP 64
✓ Agent completed: Chrome (23.0.1271.97) / Windows XP 64
✓ Agent completed: Firefox (27.0) / Windows XP 64
✓ Agent completed: Internet Explorer (8.0) / Windows XP 64
✓ 144 tests passed! (48 seconds)
@jbalsas

No takers? :cry:

@okuryu
Collaborator

Sorry for being late. I confirmed that passed tests with IE6, IE7, IE9, IE10, IE11 and Safari, but it seems to fails tests with PhantomJS as Travis CI shows.

[okuryu.local](yui3@DD-Proxy-reset-radio)$ grover tests/unit/index.html                                                                                                     
Starting Grover on 1 files with PhantomJS@1.9.7
  Running 15 concurrent tests at a time.
✖ [DragDrop]: Passed: 47 Failed: 1 Total: 48 (ignored 0) (4.204 seconds)
    test: proxy cloneNode with radio inputs
       Value should be true.
       Expected: true (boolean)
       Actual: false (boolean)
----------------------------------------------------------------
✖ [Total]: Passed: 47 Failed: 1 Total: 48 (ignored 0) (4.204 seconds)
  [Grover Execution Timer] 5.165 seconds
@jbalsas

Hey @okuryu, no problem!

I'm a bit puzzled about the test failing on PhantomJS... do you have any idea as to how to approach/fix this? Could we skip this given test for PhantomJS?

@okuryu
Collaborator

hmm, I have looked but it's weird. How about putting ignore conditional with Y.UA.phantomjs?

@okuryu okuryu commented on the diff
src/dd/tests/unit/index.html
@@ -23,6 +23,9 @@
<li>item</li>
</ul>
</div>
+ <div id="radio">
+ <input type="radio" name="test" checked></input>
@okuryu Collaborator
okuryu added a note

Maybe I think that </input> is unnecessary.

@jbalsas
jbalsas added a note

I tried, but made no difference. Test still fails in PhantomJS :cry:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@yahoocla
Owner

CLA is valid!

@jbalsas

@okuryu I've pushed a commit ignoring the test in PhantomJS. Not sure if this has triggered a new CI build, though...

@okuryu
Collaborator

@jbalsas Thanks. Looks good to me. I'll merge this when get +1 from a reviewer or after 72 hours (excludes holidays).

@okuryu okuryu added the 3 - Review label
@okuryu okuryu self-assigned this
@jbalsas

Awesome @okuryu, thanks a lot!

@okuryu okuryu removed their assignment
@apipkin apipkin was assigned by okuryu
@apipkin apipkin was unassigned by okuryu
@okuryu okuryu added this to the Sprint 13 milestone
@okuryu okuryu self-assigned this
@jbalsas jbalsas referenced this pull request in eduardolundgren/yui3
Closed

patched-v3.15.0 #12

@okuryu okuryu merged commit af77757 into yui:dev-master

1 check passed

Details default The Travis CI build passed
@okuryu
Collaborator

Merged. I believe this will be available in the next release.

@okuryu okuryu removed the 3 - Review label
@jbalsas

Cool!!

@okuryu Thanks so much for helping out and seeing this through!

@tripp tripp referenced this pull request
Merged

dd proxy test fix. #1770

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
2  src/dd/js/proxy.js
@@ -151,6 +151,8 @@
n = host.get(NODE),
c = n.cloneNode(true);
+ c.all('input[type="radio"]').removeAttribute('name');
+
delete c._yuid;
c.setAttribute('id', Y.guid());
c.setStyle('position', 'absolute');
View
24 src/dd/tests/unit/assets/dd-tests.js
@@ -92,6 +92,13 @@ YUI.add('dd-tests', function(Y) {
template = {
name: 'DD Test',
+
+ _should: {
+ ignore: {
+ 'test: proxy cloneNode with radio inputs': Y.UA.phantomjs
+ }
+ },
+
setUp : function() {
},
@@ -796,6 +803,23 @@ YUI.add('dd-tests', function(Y) {
});
+ },
+ 'test: proxy cloneNode with radio inputs': function() {
+ var radioInput = Y.one('#radio input');
+
+ _resetCount();
+
+ var dd = new Y.DD.Drag({
+ node: '#radio'
+ }).plug(Y.Plugin.DDProxy, {
+ cloneNode: true
+ });
+
+ this.wait(function() {
+ _fakeMove(dd, 1000);
+
+ Y.Assert.isTrue(radioInput.get('checked'));
+ }, 100);
}
};
View
3  src/dd/tests/unit/index.html
@@ -23,6 +23,9 @@
<li>item</li>
</ul>
</div>
+ <div id="radio">
+ <input type="radio" name="test" checked></input>
@okuryu Collaborator
okuryu added a note

Maybe I think that </input> is unnecessary.

@jbalsas
jbalsas added a note

I tried, but made no difference. Test still fails in PhantomJS :cry:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ </div>
<script>
YUI({
Something went wrong with that request. Please try again.