From 380c7aff79d2bcd6b82ce6d98f5de93ec59e4e5c Mon Sep 17 00:00:00 2001 From: zhangpaopao Date: Wed, 24 Aug 2022 16:11:02 +0800 Subject: [PATCH 1/2] test(footer): add unit test --- .../__test__/__snapshots__/index.test.js.snap | 17 +++++++++++++++ src/footer/__test__/index.test.js | 21 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/footer/__test__/__snapshots__/index.test.js.snap create mode 100644 src/footer/__test__/index.test.js diff --git a/src/footer/__test__/__snapshots__/index.test.js.snap b/src/footer/__test__/__snapshots__/index.test.js.snap new file mode 100644 index 000000000..d43294ff8 --- /dev/null +++ b/src/footer/__test__/__snapshots__/index.test.js.snap @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Footer :base 1`] = ` +
+
+ + + + + +
+
+`; diff --git a/src/footer/__test__/index.test.js b/src/footer/__test__/index.test.js new file mode 100644 index 000000000..e53d19b73 --- /dev/null +++ b/src/footer/__test__/index.test.js @@ -0,0 +1,21 @@ +import simulate from 'miniprogram-simulate'; +import path from 'path'; + +describe('Footer', () => { + const footer = simulate.load(path.resolve(__dirname, `../footer`), { + less: true, + }); + + it(':base', () => { + const id = simulate.load({ + template: ``, + usingComponents: { + 't-footer': footer, + }, + }); + const comp = simulate.render(id); + comp.attach(document.createElement('parent-wrapper')); + + expect(comp.toJSON()).toMatchSnapshot(); + }); +}); From 3b5c6827f4845aec60cab0794f7341c1ebb05080 Mon Sep 17 00:00:00 2001 From: zhangpaopao Date: Wed, 24 Aug 2022 16:42:09 +0800 Subject: [PATCH 2/2] test(footer): update badge --- src/footer/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/footer/README.md b/src/footer/README.md index 7b1c91231..2d9039ffd 100644 --- a/src/footer/README.md +++ b/src/footer/README.md @@ -5,6 +5,7 @@ spline: data isComponent: true --- + ## 引入 全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。