Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
angular-jasmine-matchers
Advanced tools
Readme
angular matchers provides a set of matchers for the Jasmine JavaScript Testing Framework:
jasmine-jquery provides following custom matchers (in alphabetical order):
toBe(jQuerySelector)
expect($('<div id="some-id"></div>')).toBe('div')
expect($('<div id="some-id"></div>')).toBe('div#some-id')
toBeChecked()
expect($('<input type="checkbox" checked="checked"/>')).toBeChecked()
toBeEmpty()
toBeHidden()
Elements can be considered hidden for several reasons:
display
value of none
.type
equal to hidden
.width
and height
are explicitly set to 0
.toHaveCss(css)
expect($('<div style="display: none; margin: 10px;"></div>')).toHaveCss({display: "none", margin: "10px"})
expect($('<div style="display: none; margin: 10px;"></div>')).toHaveCss({margin: "10px"})
toBeSelected()
expect($('<option selected="selected"></option>')).toBeSelected()
toBeVisible()
toContain(jQuerySelector)
expect($('<div><span class="some-class"></span></div>')).toContain('span.some-class')
toExist()
toHaveAttr(attributeName, attributeValue)
toHaveProp(propertyName, propertyValue)
toHaveClass(className)
expect($('<div class="some-class"></div>')).toHaveClass("some-class")
toHaveData(key, value)
toHaveHtml(string)
expect($('<div><span></span></div>')).toHaveHtml('<span></span>')
toContainHtml(string)
expect($('<div><ul></ul><h1>header</h1></div>')).toContainHtml('<ul></ul>')
toHaveId(id)
expect($('<div id="some-id"></div>')).toHaveId("some-id")
toHaveText(string)
expect($('<div>some text</div>')).toHaveText('some text')
toHaveValue(value)
expect($('<input type="text" value="some text"/>')).toHaveValue('some text')
toBeDisabled()
expect('<input type='submit' disabled='disabled'/>').toBeDisabled()
toBeFocused()
expect($('<input type='text' />').focus()).toBeFocused()
toHandle(eventName)
expect($form).toHandle("submit")
toHandleWith(eventName, eventHandler)
expect($form).toHandleWith("submit", yourSubmitCallback)
The same as with standard Jasmine matchers, all of above custom matchers may be inverted by using .not
prefix, e.g.:
expect($('<div>some text</div>')).not.toHaveText(/other/)
angular matchers was tested with Jasmine 1.2 and jQuery 1.8 on FF, Chrome, and Safari. There is a high chance it will work with older versions and other browsers as well, but I don't typically run test suite against them when adding new features.
Newer versions of Chrome don't allow file:// URIs read other file:// URIs. In effect, jasmine-jquery cannot properly load fixtures under some versions of Chrome. An override for this is to run Chrome with a switch --allow-file-access-from-files
.
Under Windows 7, you have to launch C:\Users\[UserName]\AppData\Local\Google\Chrome[ SxS]\Application\chrome.exe --allow-file-access-from-files
If you can, have another developer sanity check your change
Now offers bower support. bower install angularjs-jasmine-matchers --save
FAQs
Matchers for Jasmine Testing in AngularJS
The npm package angular-jasmine-matchers receives a total of 1 weekly downloads. As such, angular-jasmine-matchers popularity was classified as not popular.
We found that angular-jasmine-matchers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.