Ver a proveniência

Fix order of completion (#447)

pull/448/head
Xavier DETANT há 5 anos
committed by Guillaume Vincent
ascendente
cometimento
8772585e88
2 ficheiros alterados com 14 adições e 5 eliminações
  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 Ver ficheiro

@@ -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 Ver ficheiro

@@ -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', () => {


Carregando…
Cancelar
Guardar