Skip to content

Commit

Permalink
Merge branch 'main' into fix/env
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-jj authored Mar 14, 2024
2 parents 5af0009 + 66d9fbb commit 61c1ce4
Show file tree
Hide file tree
Showing 45 changed files with 1,166 additions and 155 deletions.
1 change: 1 addition & 0 deletions examples/taro-list/config/dev.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { UserConfigExport } from "@tarojs/cli";

export default {
logger: {
quiet: false,
Expand Down
1 change: 1 addition & 0 deletions examples/taro-list/config/prod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { UserConfigExport } from "@tarojs/cli";

export default {
mini: {},
h5: {
Expand Down
23 changes: 23 additions & 0 deletions packages/taro-h5/__tests__/ui/navigation.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as Taro from '@tarojs/taro-h5'

import { buildApp } from '../utils'

const mockConsole = require('jest-mock-console')

describe('navigation', () => {
Expand Down Expand Up @@ -73,4 +75,25 @@ describe('navigation', () => {
})
})
})
describe('showNavigationBarLoading / hideNavigationBarLoading', () => {
beforeEach(() => {
mockConsole()
buildApp()
})

test('should be able to showNavigationBarLoading / hideNavigationBarLoading', done => {
Taro.showNavigationBarLoading().then(res => {
expect(res.errMsg).toBe('showNavigationBarLoading:ok')
const loadingElement = document.querySelector('.taro-navigation-bar-loading-show')
expect(loadingElement).toBeTruthy()

Taro.hideNavigationBarLoading().then(res => {
expect(res.errMsg).toBe('hideNavigationBarLoading:ok')
const loadingElement = document.querySelector('.taro-navigation-bar-loading-show')
expect(loadingElement).toBeFalsy()
done()
})
})
})
})
})
23 changes: 20 additions & 3 deletions packages/taro-h5/src/api/ui/navigation-bar/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import Taro from '@tarojs/api'
import { setNavigationBarStyle, setTitle } from '@tarojs/router'
import { setNavigationBarLoading, setNavigationBarStyle, setTitle } from '@tarojs/router'

import { getParameterError, shouldBeObject, temporarilyNotSupport } from '../../../utils'
import { MethodHandler } from '../../../utils/handler'

// 导航栏
export const showNavigationBarLoading = /* @__PURE__ */ temporarilyNotSupport('showNavigationBarLoading')
/**
* 展示导航栏 loading 状态
*/
export function showNavigationBarLoading (options: Taro.showNavigationBarLoading.Option = {}) {
const { success, fail, complete } = options
const handle = new MethodHandler({ name: 'showNavigationBarLoading', success, fail, complete })
setNavigationBarLoading(true)
return handle.success()
}

export function setNavigationBarTitle (options?: Taro.setNavigationBarTitle.Option) {
// options must be an Object
Expand Down Expand Up @@ -48,5 +56,14 @@ export const setNavigationBarColor: typeof Taro.setNavigationBarColor = (options
return handle.success()
}

export const hideNavigationBarLoading = /* @__PURE__ */ temporarilyNotSupport('hideNavigationBarLoading')
/**
* 隐藏导航栏 loading 状态
*/
export function hideNavigationBarLoading (options: Taro.hideNavigationBarLoading.Option = {}) {
const { success, fail, complete } = options
const handle = new MethodHandler({ name: 'hideNavigationBarLoading', success, fail, complete })
setNavigationBarLoading(false)
return handle.success()
}

export const hideHomeButton = /* @__PURE__ */ temporarilyNotSupport('hideHomeButton')
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,13 @@
"NfcB": false,
"NfcF": false,
"NfcV": false,
"NodesRef": {
"boundingClientRect": true,
"context": true,
"node": true,
"fields": true,
"scrollOffset": true
},
"OffscreenCanvas": false,
"Path2D": true,
"Performance": false,
Expand Down Expand Up @@ -1232,6 +1239,12 @@
"TRACE": true,
"CONNECT": true
},
"dataType": {
"json": true,
"text": true,
"base64": true,
"arraybuffer": true
},
"responseType": {
"text": true,
"arraybuffer": true
Expand Down Expand Up @@ -2112,6 +2125,7 @@
},
"rtc-room": false,
"rtc-room-item": false,
"script.ts": false,
"scroll-view": {
"scroll-x": true,
"scroll-y": true,
Expand Down Expand Up @@ -2157,7 +2171,8 @@
"refresher-two-level-close-threshold": false,
"refresher-two-level-scroll-enabled": false,
"refresher-ballistic-refresh-enabled": false,
"refresher-two-level-pinned": false
"refresher-two-level-pinned": false,
"using-sticky": false
},
"share-element": {
"key": false,
Expand Down
Loading

0 comments on commit 61c1ce4

Please sign in to comment.