New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue-typeahead-bootstrap

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-typeahead-bootstrap - npm Package Compare versions

Comparing version 2.6.1 to 2.7.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## 2.7.0 - 31 Dec 2020
- Add support for different background colors per list item
- NOTE: also changing from `bg-${context}` to `list-group-item-${context}` to match bootstrap docs and allow text colors to change automatically
## 2.6.1 - 28 Dec 2020

@@ -2,0 +6,0 @@ - Add internationalization support, specifically for diacritics (accents, etc)

2

package.json
{
"name": "vue-typeahead-bootstrap",
"version": "2.6.1",
"version": "2.7.0",
"private": false,

@@ -5,0 +5,0 @@ "description": "A typeahead/autocomplete component for Vue 2 using Bootstrap 4",

@@ -24,4 +24,66 @@ import { shallowMount } from '@vue/test-utils'

await wrapper.vm.$nextTick()
expect(wrapper.classes()).toEqual(expect.arrayContaining(['bg-light']))
expect(wrapper.classes()).toEqual(expect.arrayContaining(['list-group-item-light']))
})
it('Renders text classes properly when backgroundVariantResolver is not specified', async () => {
const baseClasses = [...wrapper.vm.baseTextClasses]
expect(wrapper.classes()).toHaveLength(baseClasses.length)
expect(wrapper.classes()).toEqual(expect.arrayContaining([...baseClasses]))
})
it('Renders text classes properly when backgroundVariantResolver returns non-string', async () => {
const baseClasses = [...wrapper.vm.baseTextClasses]
const resolver1 = () => [ 'light', 'dark' ]
wrapper.setProps({ backgroundVariantResolver: resolver1 })
await wrapper.vm.$nextTick()
// the first resolver returns an array when it should be returning a string;
// therefore the classes assigned to the wrapper should be the same as the
// base classes.
expect(wrapper.classes()).toHaveLength(baseClasses.length)
expect(wrapper.classes()).toEqual(expect.arrayContaining([...baseClasses]))
const resolver2 = () => ({ 'class1': 'light', 'class2': 'dark' })
wrapper.setProps({ backgroundVariantResolver: resolver2 })
await wrapper.vm.$nextTick()
// the second resolver returns an object, therefore the classes
// assigned to the wrapper should also be the same as the base classes.
expect(wrapper.classes()).toHaveLength(baseClasses.length)
expect(wrapper.classes()).toEqual(expect.arrayContaining([...baseClasses]))
})
it('Renders backgroundVariantResolver classes properly', async () => {
const baseClasses = [...wrapper.vm.baseTextClasses]
const testItems = [
{
data: { 'prop': 'light' },
resolver: (d) => d.prop
},
{
data: { 'prop': 'dark' },
resolver: (d) => d.prop
},
{
data: { 'prop': 'warning' },
resolver: (d) => d.prop
}
]
// iterate through the test items which specify a classname to add
// and a resolver to use.
for (let i = 0; i < testItems.length; i++) {
wrapper.setProps({ backgroundVariantResolver: testItems[i].resolver, data: testItems[i].data })
await wrapper.vm.$nextTick()
// this should be adding a single class to the baseClasses, should not be appending
expect(wrapper.classes()).toHaveLength(baseClasses.length + 1)
expect(wrapper.classes()).toEqual(expect.arrayContaining([`list-group-item-${[testItems[i].data.prop]}`]))
}
})
it('Favors backgroundVariantResolver class over backgroundVariant class', async () => {
const baseClasses = [...wrapper.vm.baseTextClasses]
const resolver1 = () => 'dark'
// we are specifying both a backgroungVariant and a backgroundVariantResolver
wrapper.setProps({ backgroundVariant: 'light', backgroundVariantResolver: resolver1 })
await wrapper.vm.$nextTick()
expect(wrapper.classes()).toHaveLength(baseClasses.length + 1)
expect(wrapper.classes()).toEqual(expect.arrayContaining([`list-group-item-dark`]))
})
})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc