Skip to content
This repository has been archived by the owner on Sep 7, 2018. It is now read-only.

assert.match and parentNode #64

Closed
cjohansen opened this issue Feb 10, 2012 · 6 comments · Fixed by sinonjs/samsam#9
Closed

assert.match and parentNode #64

cjohansen opened this issue Feb 10, 2012 · 6 comments · Fixed by sinonjs/samsam#9
Assignees
Milestone

Comments

@cjohansen
Copy link
Member

@magnars wants:

assert.match(element, {
    tagName: "a",
    innerHTML: "stuff",
    href: "#",
    parentNode: otherElement
});
@augustl
Copy link
Member

augustl commented Feb 17, 2012

IMO @magnars should write the code for that!

@dominykas
Copy link
Member

My pull request should fix the immediate issue of Element not matching itself (there was no reference check in samsam). However there's still a question if assert.match(undefined, undefined) should pass or fail.

@dominykas
Copy link
Member

Apparently assert.match(null, null) also fails - and should probably pass? #359

On the other hand, if we have expectations for null or undefined, there's specific methods for that - so I guess this should only apply to matching properties of an object.

@dkl-ppi
Copy link
Member

dkl-ppi commented Dec 10, 2014

Is this feature really completely realized? What has to happen with the parentNode attribute?

@dominykas
Copy link
Member

The matcher in the original issue used to fail, because not all properties on an HTMLElement contain a value (they're either null or undefined). This has been fixed in two ways now:

  1. object with null values will match another object with null values (given everything else matches)
  2. short-circuited true for matching an object against itself (therefore parentNode will match if it's === otherElement)

Maybe some extra tests just to make sure are a good idea? Just not sure where to add them? Which modules run tests (and how to do it) in the browser?

@dkl-ppi
Copy link
Member

dkl-ppi commented Dec 11, 2014

For the buster module JsTestDriver tests are configured, but i am quite sure, they don't run anymore. As far as i know, we currently don't run any browser tests on travis.ci. This is a task, we should take care of in the near future.
The important information for me now is, that the feature is completely realized and the issues can be closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants