Conversation
0cf7223 to
90d7c34
Compare
|
needs to be rebased and CI is failing. otherwise it looks reasonable. @juliemr can you take a look too please? |
|
I would love to have this matcher, would come handy in few tests I've written before (ex. ones for NgStyle and some integration tests) |
90d7c34 to
6b30dcf
Compare
|
Rebased on master. |
There was a problem hiding this comment.
Style nitpick: We don't really need the custom negativeCompare here. Instead I'd do:
toHaveCssStyle: function() {
return {compare: {
return function(actual, styles) {
var allPassed;
if (isString(styles)) {
allPassed = DOM.hasStyle(actual, styles);
} else {
allPassed = !StringMapWrapper.isEmpty(styles);
StringMapWrapper.forEach(styles, (style, prop) => {
allPassed = allPassed && DOM.hasStyle(actual, prop, style);
});
}
return {
pass: allPassed,
get message() {
var expectedValueStr = isString(styles) ? styles : JSON.stringify(styles);
return `Expected ${actual.outerHTML} ${!allPassed ? 'not ' : ''} to contain the
CSS ${isString(styles) ? 'property' : 'styles'} "${expectedValueStr}"`;
}
};
};
}
},There was a problem hiding this comment.
This makes sense up to the point where we use !allPassed to turn on the "not " token within the error message. That doesn't look right.
There was a problem hiding this comment.
It's the recommended way in the Jasmine docs though - if it didn't pass but we're throwing an error, we know the check was with a .not.
There was a problem hiding this comment.
True. OK. I've updated the changes and force pushed.
There was a problem hiding this comment.
CI still not happy
On Fri, Nov 20, 2015 at 9:50 AM Matias Niemelä notifications@github.com
wrote:
In modules/angular2/src/testing/matchers.ts
#5371 (comment):@@ -105,6 +107,33 @@ _global.beforeEach(function() {
}
},
- toHaveCssStyle: function() {
return {compare: buildError(false), negativeCompare: buildError(true)};True. OK. I've updated the changes and force pushed.
—
Reply to this email directly or view it on GitHub
https://github.com/angular/angular/pull/5371/files#r45496685.
|
Looks good to me except for one optional nitpick. |
6b30dcf to
82bc295
Compare
There was a problem hiding this comment.
I think it should be the other way around: !allPassed ? '' : 'not'
6c566e5 to
0a9bff4
Compare
0a9bff4 to
f10d006
Compare
There was a problem hiding this comment.
Pretty minor, but ' ' should be '' to avoid excess whitespace.
f10d006 to
9fa212d
Compare
9fa212d to
147688c
Compare
|
Merging PR #5371 on behalf of @alxhub to branch presubmit-alxhub-pr-5371. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.