Bladeren bron

Fix order of completion (#447)

pull/448/head
Xavier DETANT 5 jaren geleden
committed by Guillaume Vincent
bovenliggende
commit
8772585e88
2 gewijzigde bestanden met toevoegingen van 14 en 5 verwijderingen
  1. +4
    -0
      packages/lesspass-pure/src/components/InputSite.vue
  2. +10
    -5
      packages/lesspass-pure/src/components/input-site.test.js

+ 4
- 0
packages/lesspass-pure/src/components/InputSite.vue Bestand weergeven

@@ -59,6 +59,10 @@
this.$emit("passwordProfileSelected", password.value);
}
};
this.awesomplete.sort = (a,b) => {
return a.value.site.localeCompare(b.value.site) ||
a.value.login.localeCompare(b.value.login);
}
},
computed: {
site: {


+ 10
- 5
packages/lesspass-pure/src/components/input-site.test.js Bestand weergeven

@@ -71,17 +71,22 @@ describe('InputSite', () => {
let options = optionsFor(wrapper);
expect(options.length).toBe(0);
});
it(`prints all options`, () => {
it(`prints options sorted by site then login`, () => {
const wrapper = createWrapper({
passwords: [
{site: "lesspass", login: "guillaume"},
{site: "passless", login: "xavier"},
{site: "passless", login: "guillaume"},
{site: "lesspass", login: "xavier"},
{site: "lesspass", login: "guillaume"}]
]
});
inputField(wrapper).setValue("le");
let options = optionsFor(wrapper);
expect(options.length).toBe(2);
expect(options.at(0).text()).toContain("lesspass");
expect(options.at(1).text()).toContain("lesspass");
expect(options.length).toBe(4);
expect(options.at(0).text()).toBe("lesspass guillaume");
expect(options.at(1).text()).toBe("lesspass xavier");
expect(options.at(2).text()).toBe("passless guillaume");
expect(options.at(3).text()).toBe("passless xavier");
});
});
describe('completion', () => {


Laden…
Annuleren
Opslaan