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

adds the ability to ignore types by selector #94

Merged

Conversation

rhubarbselleven
Copy link
Contributor

You can add a selector to ignoredTypes which will exclude the field from serialise / deserialise if it matches

var identifier = extractor($(el));

var foundInIgnored = _.include(config.ignoredTypes, type);
var foundInIgnored = _.find(config.ignoredTypes, function(ignoredTypeOrSelector) {
return (ignoredTypeOrSelector === myType) || $(el).is(ignoredTypeOrSelector);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I found that in the original PR

You advanced to level 2

Wooooo

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

});

it('should not include fields excluded by selector', function() {
expect(this.result).not.to.have.ownProperty('b');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh i mean

expect(this.result).to.eql([....])

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, gotcha.

Lightbulb 💡

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated 👯

@rhubarbselleven
Copy link
Contributor Author

Ugh, hold this. I just wrote a failing testcase for the deserialize side of things

expect(this.result).to.eql('myOriginalValue'); // fail !

@rhubarbselleven rhubarbselleven force-pushed the selectors-can-ignore-too branch 2 times, most recently from bad13b4 to 4493218 Compare March 14, 2015 02:34
@rhubarbselleven
Copy link
Contributor Author

HA! Was due to a typo

Rhubarbs learned the power of debugging tests

@samccone
Copy link
Member

Lgtm. Great work

rhubarbselleven added a commit that referenced this pull request Mar 14, 2015
adds the ability to ignore types by selector
@rhubarbselleven rhubarbselleven merged commit f1c09a7 into marionettejs:minor Mar 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants